{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src=\"http://hilpisch.com/tpq_logo.png\" alt=\"The Python Quants\" width=\"35%\" align=\"right\" border=\"0\"><br>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Python for Finance (2nd ed.)\n",
    "\n",
    "**Mastering Data-Driven Finance**\n",
    "\n",
    "&copy; Dr. Yves J. Hilpisch | The Python Quants GmbH\n",
    "\n",
    "<img src=\"http://hilpisch.com/images/py4fi_2nd_shadow.png\" width=\"300px\" align=\"left\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Performance Python"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import warnings\n",
    "warnings.simplefilter('ignore')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Loops"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Python"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import random"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "def average_py(n):\n",
    "    s = 0  \n",
    "    for i in range(n):\n",
    "        s += random.random()  \n",
    "    return s / n  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "n = 10000000  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 534 ms, sys: 5.82 ms, total: 540 ms\n",
      "Wall time: 538 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.499955992810787"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time average_py(n)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "531 ms ± 4.09 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
     ]
    }
   ],
   "source": [
    "%timeit average_py(n)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 544 ms, sys: 61.8 ms, total: 605 ms\n",
      "Wall time: 607 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.5000374357408551"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time sum([random.random() for _ in range(n)]) / n  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### NumPy "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "def average_np(n):\n",
    "    s = np.random.random(n)  \n",
    "    return s.mean()  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 36.6 ms, sys: 8.91 ms, total: 45.5 ms\n",
      "Wall time: 44.4 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.4999091362859967"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time average_np(n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "41.9 ms ± 569 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
     ]
    }
   ],
   "source": [
    "%timeit average_np(n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "80000000"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s = np.random.random(n)\n",
    "s.nbytes  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Numba"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numba"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "average_nb = numba.jit(average_py, nopython=True)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 174 ms, sys: 19.8 ms, total: 194 ms\n",
      "Wall time: 228 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.49999644804300664"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time average_nb(n)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 24.4 ms, sys: 567 µs, total: 24.9 ms\n",
      "Wall time: 24.6 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.5000159506415159"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time average_nb(n)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "23.6 ms ± 126 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
     ]
    }
   ],
   "source": [
    "%timeit average_nb(n)  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Cython"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "%load_ext Cython"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<!-- Generated by Cython 3.0.3 -->\n",
       "<html>\n",
       "<head>\n",
       "    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n",
       "    <title>Cython: _cython_magic_34cab0d959aefb4fde3de70fe51382b812ea3f8d.pyx</title>\n",
       "    <style type=\"text/css\">\n",
       "    \n",
       "body.cython { font-family: courier; font-size: 12; }\n",
       "\n",
       ".cython.tag  {  }\n",
       ".cython.line { color: #000000; margin: 0em }\n",
       ".cython.code { font-size: 9; color: #444444; display: none; margin: 0px 0px 0px 8px; border-left: 8px none; }\n",
       "\n",
       ".cython.line .run { background-color: #B0FFB0; }\n",
       ".cython.line .mis { background-color: #FFB0B0; }\n",
       ".cython.code.run  { border-left: 8px solid #B0FFB0; }\n",
       ".cython.code.mis  { border-left: 8px solid #FFB0B0; }\n",
       "\n",
       ".cython.code .py_c_api  { color: red; }\n",
       ".cython.code .py_macro_api  { color: #FF7000; }\n",
       ".cython.code .pyx_c_api  { color: #FF3000; }\n",
       ".cython.code .pyx_macro_api  { color: #FF7000; }\n",
       ".cython.code .refnanny  { color: #FFA000; }\n",
       ".cython.code .trace  { color: #FFA000; }\n",
       ".cython.code .error_goto  { color: #FFA000; }\n",
       "\n",
       ".cython.code .coerce  { color: #008000; border: 1px dotted #008000 }\n",
       ".cython.code .py_attr { color: #FF0000; font-weight: bold; }\n",
       ".cython.code .c_attr  { color: #0000FF; }\n",
       ".cython.code .py_call { color: #FF0000; font-weight: bold; }\n",
       ".cython.code .c_call  { color: #0000FF; }\n",
       "\n",
       ".cython.score-0 {background-color: #FFFFff;}\n",
       ".cython.score-1 {background-color: #FFFFe7;}\n",
       ".cython.score-2 {background-color: #FFFFd4;}\n",
       ".cython.score-3 {background-color: #FFFFc4;}\n",
       ".cython.score-4 {background-color: #FFFFb6;}\n",
       ".cython.score-5 {background-color: #FFFFaa;}\n",
       ".cython.score-6 {background-color: #FFFF9f;}\n",
       ".cython.score-7 {background-color: #FFFF96;}\n",
       ".cython.score-8 {background-color: #FFFF8d;}\n",
       ".cython.score-9 {background-color: #FFFF86;}\n",
       ".cython.score-10 {background-color: #FFFF7f;}\n",
       ".cython.score-11 {background-color: #FFFF79;}\n",
       ".cython.score-12 {background-color: #FFFF73;}\n",
       ".cython.score-13 {background-color: #FFFF6e;}\n",
       ".cython.score-14 {background-color: #FFFF6a;}\n",
       ".cython.score-15 {background-color: #FFFF66;}\n",
       ".cython.score-16 {background-color: #FFFF62;}\n",
       ".cython.score-17 {background-color: #FFFF5e;}\n",
       ".cython.score-18 {background-color: #FFFF5b;}\n",
       ".cython.score-19 {background-color: #FFFF57;}\n",
       ".cython.score-20 {background-color: #FFFF55;}\n",
       ".cython.score-21 {background-color: #FFFF52;}\n",
       ".cython.score-22 {background-color: #FFFF4f;}\n",
       ".cython.score-23 {background-color: #FFFF4d;}\n",
       ".cython.score-24 {background-color: #FFFF4b;}\n",
       ".cython.score-25 {background-color: #FFFF48;}\n",
       ".cython.score-26 {background-color: #FFFF46;}\n",
       ".cython.score-27 {background-color: #FFFF44;}\n",
       ".cython.score-28 {background-color: #FFFF43;}\n",
       ".cython.score-29 {background-color: #FFFF41;}\n",
       ".cython.score-30 {background-color: #FFFF3f;}\n",
       ".cython.score-31 {background-color: #FFFF3e;}\n",
       ".cython.score-32 {background-color: #FFFF3c;}\n",
       ".cython.score-33 {background-color: #FFFF3b;}\n",
       ".cython.score-34 {background-color: #FFFF39;}\n",
       ".cython.score-35 {background-color: #FFFF38;}\n",
       ".cython.score-36 {background-color: #FFFF37;}\n",
       ".cython.score-37 {background-color: #FFFF36;}\n",
       ".cython.score-38 {background-color: #FFFF35;}\n",
       ".cython.score-39 {background-color: #FFFF34;}\n",
       ".cython.score-40 {background-color: #FFFF33;}\n",
       ".cython.score-41 {background-color: #FFFF32;}\n",
       ".cython.score-42 {background-color: #FFFF31;}\n",
       ".cython.score-43 {background-color: #FFFF30;}\n",
       ".cython.score-44 {background-color: #FFFF2f;}\n",
       ".cython.score-45 {background-color: #FFFF2e;}\n",
       ".cython.score-46 {background-color: #FFFF2d;}\n",
       ".cython.score-47 {background-color: #FFFF2c;}\n",
       ".cython.score-48 {background-color: #FFFF2b;}\n",
       ".cython.score-49 {background-color: #FFFF2b;}\n",
       ".cython.score-50 {background-color: #FFFF2a;}\n",
       ".cython.score-51 {background-color: #FFFF29;}\n",
       ".cython.score-52 {background-color: #FFFF29;}\n",
       ".cython.score-53 {background-color: #FFFF28;}\n",
       ".cython.score-54 {background-color: #FFFF27;}\n",
       ".cython.score-55 {background-color: #FFFF27;}\n",
       ".cython.score-56 {background-color: #FFFF26;}\n",
       ".cython.score-57 {background-color: #FFFF26;}\n",
       ".cython.score-58 {background-color: #FFFF25;}\n",
       ".cython.score-59 {background-color: #FFFF24;}\n",
       ".cython.score-60 {background-color: #FFFF24;}\n",
       ".cython.score-61 {background-color: #FFFF23;}\n",
       ".cython.score-62 {background-color: #FFFF23;}\n",
       ".cython.score-63 {background-color: #FFFF22;}\n",
       ".cython.score-64 {background-color: #FFFF22;}\n",
       ".cython.score-65 {background-color: #FFFF22;}\n",
       ".cython.score-66 {background-color: #FFFF21;}\n",
       ".cython.score-67 {background-color: #FFFF21;}\n",
       ".cython.score-68 {background-color: #FFFF20;}\n",
       ".cython.score-69 {background-color: #FFFF20;}\n",
       ".cython.score-70 {background-color: #FFFF1f;}\n",
       ".cython.score-71 {background-color: #FFFF1f;}\n",
       ".cython.score-72 {background-color: #FFFF1f;}\n",
       ".cython.score-73 {background-color: #FFFF1e;}\n",
       ".cython.score-74 {background-color: #FFFF1e;}\n",
       ".cython.score-75 {background-color: #FFFF1e;}\n",
       ".cython.score-76 {background-color: #FFFF1d;}\n",
       ".cython.score-77 {background-color: #FFFF1d;}\n",
       ".cython.score-78 {background-color: #FFFF1c;}\n",
       ".cython.score-79 {background-color: #FFFF1c;}\n",
       ".cython.score-80 {background-color: #FFFF1c;}\n",
       ".cython.score-81 {background-color: #FFFF1c;}\n",
       ".cython.score-82 {background-color: #FFFF1b;}\n",
       ".cython.score-83 {background-color: #FFFF1b;}\n",
       ".cython.score-84 {background-color: #FFFF1b;}\n",
       ".cython.score-85 {background-color: #FFFF1a;}\n",
       ".cython.score-86 {background-color: #FFFF1a;}\n",
       ".cython.score-87 {background-color: #FFFF1a;}\n",
       ".cython.score-88 {background-color: #FFFF1a;}\n",
       ".cython.score-89 {background-color: #FFFF19;}\n",
       ".cython.score-90 {background-color: #FFFF19;}\n",
       ".cython.score-91 {background-color: #FFFF19;}\n",
       ".cython.score-92 {background-color: #FFFF19;}\n",
       ".cython.score-93 {background-color: #FFFF18;}\n",
       ".cython.score-94 {background-color: #FFFF18;}\n",
       ".cython.score-95 {background-color: #FFFF18;}\n",
       ".cython.score-96 {background-color: #FFFF18;}\n",
       ".cython.score-97 {background-color: #FFFF17;}\n",
       ".cython.score-98 {background-color: #FFFF17;}\n",
       ".cython.score-99 {background-color: #FFFF17;}\n",
       ".cython.score-100 {background-color: #FFFF17;}\n",
       ".cython.score-101 {background-color: #FFFF16;}\n",
       ".cython.score-102 {background-color: #FFFF16;}\n",
       ".cython.score-103 {background-color: #FFFF16;}\n",
       ".cython.score-104 {background-color: #FFFF16;}\n",
       ".cython.score-105 {background-color: #FFFF16;}\n",
       ".cython.score-106 {background-color: #FFFF15;}\n",
       ".cython.score-107 {background-color: #FFFF15;}\n",
       ".cython.score-108 {background-color: #FFFF15;}\n",
       ".cython.score-109 {background-color: #FFFF15;}\n",
       ".cython.score-110 {background-color: #FFFF15;}\n",
       ".cython.score-111 {background-color: #FFFF15;}\n",
       ".cython.score-112 {background-color: #FFFF14;}\n",
       ".cython.score-113 {background-color: #FFFF14;}\n",
       ".cython.score-114 {background-color: #FFFF14;}\n",
       ".cython.score-115 {background-color: #FFFF14;}\n",
       ".cython.score-116 {background-color: #FFFF14;}\n",
       ".cython.score-117 {background-color: #FFFF14;}\n",
       ".cython.score-118 {background-color: #FFFF13;}\n",
       ".cython.score-119 {background-color: #FFFF13;}\n",
       ".cython.score-120 {background-color: #FFFF13;}\n",
       ".cython.score-121 {background-color: #FFFF13;}\n",
       ".cython.score-122 {background-color: #FFFF13;}\n",
       ".cython.score-123 {background-color: #FFFF13;}\n",
       ".cython.score-124 {background-color: #FFFF13;}\n",
       ".cython.score-125 {background-color: #FFFF12;}\n",
       ".cython.score-126 {background-color: #FFFF12;}\n",
       ".cython.score-127 {background-color: #FFFF12;}\n",
       ".cython.score-128 {background-color: #FFFF12;}\n",
       ".cython.score-129 {background-color: #FFFF12;}\n",
       ".cython.score-130 {background-color: #FFFF12;}\n",
       ".cython.score-131 {background-color: #FFFF12;}\n",
       ".cython.score-132 {background-color: #FFFF11;}\n",
       ".cython.score-133 {background-color: #FFFF11;}\n",
       ".cython.score-134 {background-color: #FFFF11;}\n",
       ".cython.score-135 {background-color: #FFFF11;}\n",
       ".cython.score-136 {background-color: #FFFF11;}\n",
       ".cython.score-137 {background-color: #FFFF11;}\n",
       ".cython.score-138 {background-color: #FFFF11;}\n",
       ".cython.score-139 {background-color: #FFFF11;}\n",
       ".cython.score-140 {background-color: #FFFF11;}\n",
       ".cython.score-141 {background-color: #FFFF10;}\n",
       ".cython.score-142 {background-color: #FFFF10;}\n",
       ".cython.score-143 {background-color: #FFFF10;}\n",
       ".cython.score-144 {background-color: #FFFF10;}\n",
       ".cython.score-145 {background-color: #FFFF10;}\n",
       ".cython.score-146 {background-color: #FFFF10;}\n",
       ".cython.score-147 {background-color: #FFFF10;}\n",
       ".cython.score-148 {background-color: #FFFF10;}\n",
       ".cython.score-149 {background-color: #FFFF10;}\n",
       ".cython.score-150 {background-color: #FFFF0f;}\n",
       ".cython.score-151 {background-color: #FFFF0f;}\n",
       ".cython.score-152 {background-color: #FFFF0f;}\n",
       ".cython.score-153 {background-color: #FFFF0f;}\n",
       ".cython.score-154 {background-color: #FFFF0f;}\n",
       ".cython.score-155 {background-color: #FFFF0f;}\n",
       ".cython.score-156 {background-color: #FFFF0f;}\n",
       ".cython.score-157 {background-color: #FFFF0f;}\n",
       ".cython.score-158 {background-color: #FFFF0f;}\n",
       ".cython.score-159 {background-color: #FFFF0f;}\n",
       ".cython.score-160 {background-color: #FFFF0f;}\n",
       ".cython.score-161 {background-color: #FFFF0e;}\n",
       ".cython.score-162 {background-color: #FFFF0e;}\n",
       ".cython.score-163 {background-color: #FFFF0e;}\n",
       ".cython.score-164 {background-color: #FFFF0e;}\n",
       ".cython.score-165 {background-color: #FFFF0e;}\n",
       ".cython.score-166 {background-color: #FFFF0e;}\n",
       ".cython.score-167 {background-color: #FFFF0e;}\n",
       ".cython.score-168 {background-color: #FFFF0e;}\n",
       ".cython.score-169 {background-color: #FFFF0e;}\n",
       ".cython.score-170 {background-color: #FFFF0e;}\n",
       ".cython.score-171 {background-color: #FFFF0e;}\n",
       ".cython.score-172 {background-color: #FFFF0e;}\n",
       ".cython.score-173 {background-color: #FFFF0d;}\n",
       ".cython.score-174 {background-color: #FFFF0d;}\n",
       ".cython.score-175 {background-color: #FFFF0d;}\n",
       ".cython.score-176 {background-color: #FFFF0d;}\n",
       ".cython.score-177 {background-color: #FFFF0d;}\n",
       ".cython.score-178 {background-color: #FFFF0d;}\n",
       ".cython.score-179 {background-color: #FFFF0d;}\n",
       ".cython.score-180 {background-color: #FFFF0d;}\n",
       ".cython.score-181 {background-color: #FFFF0d;}\n",
       ".cython.score-182 {background-color: #FFFF0d;}\n",
       ".cython.score-183 {background-color: #FFFF0d;}\n",
       ".cython.score-184 {background-color: #FFFF0d;}\n",
       ".cython.score-185 {background-color: #FFFF0d;}\n",
       ".cython.score-186 {background-color: #FFFF0d;}\n",
       ".cython.score-187 {background-color: #FFFF0c;}\n",
       ".cython.score-188 {background-color: #FFFF0c;}\n",
       ".cython.score-189 {background-color: #FFFF0c;}\n",
       ".cython.score-190 {background-color: #FFFF0c;}\n",
       ".cython.score-191 {background-color: #FFFF0c;}\n",
       ".cython.score-192 {background-color: #FFFF0c;}\n",
       ".cython.score-193 {background-color: #FFFF0c;}\n",
       ".cython.score-194 {background-color: #FFFF0c;}\n",
       ".cython.score-195 {background-color: #FFFF0c;}\n",
       ".cython.score-196 {background-color: #FFFF0c;}\n",
       ".cython.score-197 {background-color: #FFFF0c;}\n",
       ".cython.score-198 {background-color: #FFFF0c;}\n",
       ".cython.score-199 {background-color: #FFFF0c;}\n",
       ".cython.score-200 {background-color: #FFFF0c;}\n",
       ".cython.score-201 {background-color: #FFFF0c;}\n",
       ".cython.score-202 {background-color: #FFFF0c;}\n",
       ".cython.score-203 {background-color: #FFFF0b;}\n",
       ".cython.score-204 {background-color: #FFFF0b;}\n",
       ".cython.score-205 {background-color: #FFFF0b;}\n",
       ".cython.score-206 {background-color: #FFFF0b;}\n",
       ".cython.score-207 {background-color: #FFFF0b;}\n",
       ".cython.score-208 {background-color: #FFFF0b;}\n",
       ".cython.score-209 {background-color: #FFFF0b;}\n",
       ".cython.score-210 {background-color: #FFFF0b;}\n",
       ".cython.score-211 {background-color: #FFFF0b;}\n",
       ".cython.score-212 {background-color: #FFFF0b;}\n",
       ".cython.score-213 {background-color: #FFFF0b;}\n",
       ".cython.score-214 {background-color: #FFFF0b;}\n",
       ".cython.score-215 {background-color: #FFFF0b;}\n",
       ".cython.score-216 {background-color: #FFFF0b;}\n",
       ".cython.score-217 {background-color: #FFFF0b;}\n",
       ".cython.score-218 {background-color: #FFFF0b;}\n",
       ".cython.score-219 {background-color: #FFFF0b;}\n",
       ".cython.score-220 {background-color: #FFFF0b;}\n",
       ".cython.score-221 {background-color: #FFFF0b;}\n",
       ".cython.score-222 {background-color: #FFFF0a;}\n",
       ".cython.score-223 {background-color: #FFFF0a;}\n",
       ".cython.score-224 {background-color: #FFFF0a;}\n",
       ".cython.score-225 {background-color: #FFFF0a;}\n",
       ".cython.score-226 {background-color: #FFFF0a;}\n",
       ".cython.score-227 {background-color: #FFFF0a;}\n",
       ".cython.score-228 {background-color: #FFFF0a;}\n",
       ".cython.score-229 {background-color: #FFFF0a;}\n",
       ".cython.score-230 {background-color: #FFFF0a;}\n",
       ".cython.score-231 {background-color: #FFFF0a;}\n",
       ".cython.score-232 {background-color: #FFFF0a;}\n",
       ".cython.score-233 {background-color: #FFFF0a;}\n",
       ".cython.score-234 {background-color: #FFFF0a;}\n",
       ".cython.score-235 {background-color: #FFFF0a;}\n",
       ".cython.score-236 {background-color: #FFFF0a;}\n",
       ".cython.score-237 {background-color: #FFFF0a;}\n",
       ".cython.score-238 {background-color: #FFFF0a;}\n",
       ".cython.score-239 {background-color: #FFFF0a;}\n",
       ".cython.score-240 {background-color: #FFFF0a;}\n",
       ".cython.score-241 {background-color: #FFFF0a;}\n",
       ".cython.score-242 {background-color: #FFFF0a;}\n",
       ".cython.score-243 {background-color: #FFFF0a;}\n",
       ".cython.score-244 {background-color: #FFFF0a;}\n",
       ".cython.score-245 {background-color: #FFFF0a;}\n",
       ".cython.score-246 {background-color: #FFFF09;}\n",
       ".cython.score-247 {background-color: #FFFF09;}\n",
       ".cython.score-248 {background-color: #FFFF09;}\n",
       ".cython.score-249 {background-color: #FFFF09;}\n",
       ".cython.score-250 {background-color: #FFFF09;}\n",
       ".cython.score-251 {background-color: #FFFF09;}\n",
       ".cython.score-252 {background-color: #FFFF09;}\n",
       ".cython.score-253 {background-color: #FFFF09;}\n",
       ".cython.score-254 {background-color: #FFFF09;}\n",
       "pre { line-height: 125%; }\n",
       "td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }\n",
       "span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }\n",
       "td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }\n",
       "span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }\n",
       ".cython .hll { background-color: #ffffcc }\n",
       ".cython { background: #f8f8f8; }\n",
       ".cython .c { color: #3D7B7B; font-style: italic } /* Comment */\n",
       ".cython .err { border: 1px solid #FF0000 } /* Error */\n",
       ".cython .k { color: #008000; font-weight: bold } /* Keyword */\n",
       ".cython .o { color: #666666 } /* Operator */\n",
       ".cython .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */\n",
       ".cython .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */\n",
       ".cython .cp { color: #9C6500 } /* Comment.Preproc */\n",
       ".cython .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */\n",
       ".cython .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */\n",
       ".cython .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */\n",
       ".cython .gd { color: #A00000 } /* Generic.Deleted */\n",
       ".cython .ge { font-style: italic } /* Generic.Emph */\n",
       ".cython .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */\n",
       ".cython .gr { color: #E40000 } /* Generic.Error */\n",
       ".cython .gh { color: #000080; font-weight: bold } /* Generic.Heading */\n",
       ".cython .gi { color: #008400 } /* Generic.Inserted */\n",
       ".cython .go { color: #717171 } /* Generic.Output */\n",
       ".cython .gp { color: #000080; font-weight: bold } /* Generic.Prompt */\n",
       ".cython .gs { font-weight: bold } /* Generic.Strong */\n",
       ".cython .gu { color: #800080; font-weight: bold } /* Generic.Subheading */\n",
       ".cython .gt { color: #0044DD } /* Generic.Traceback */\n",
       ".cython .kc { color: #008000; font-weight: bold } /* Keyword.Constant */\n",
       ".cython .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */\n",
       ".cython .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */\n",
       ".cython .kp { color: #008000 } /* Keyword.Pseudo */\n",
       ".cython .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */\n",
       ".cython .kt { color: #B00040 } /* Keyword.Type */\n",
       ".cython .m { color: #666666 } /* Literal.Number */\n",
       ".cython .s { color: #BA2121 } /* Literal.String */\n",
       ".cython .na { color: #687822 } /* Name.Attribute */\n",
       ".cython .nb { color: #008000 } /* Name.Builtin */\n",
       ".cython .nc { color: #0000FF; font-weight: bold } /* Name.Class */\n",
       ".cython .no { color: #880000 } /* Name.Constant */\n",
       ".cython .nd { color: #AA22FF } /* Name.Decorator */\n",
       ".cython .ni { color: #717171; font-weight: bold } /* Name.Entity */\n",
       ".cython .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */\n",
       ".cython .nf { color: #0000FF } /* Name.Function */\n",
       ".cython .nl { color: #767600 } /* Name.Label */\n",
       ".cython .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */\n",
       ".cython .nt { color: #008000; font-weight: bold } /* Name.Tag */\n",
       ".cython .nv { color: #19177C } /* Name.Variable */\n",
       ".cython .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */\n",
       ".cython .w { color: #bbbbbb } /* Text.Whitespace */\n",
       ".cython .mb { color: #666666 } /* Literal.Number.Bin */\n",
       ".cython .mf { color: #666666 } /* Literal.Number.Float */\n",
       ".cython .mh { color: #666666 } /* Literal.Number.Hex */\n",
       ".cython .mi { color: #666666 } /* Literal.Number.Integer */\n",
       ".cython .mo { color: #666666 } /* Literal.Number.Oct */\n",
       ".cython .sa { color: #BA2121 } /* Literal.String.Affix */\n",
       ".cython .sb { color: #BA2121 } /* Literal.String.Backtick */\n",
       ".cython .sc { color: #BA2121 } /* Literal.String.Char */\n",
       ".cython .dl { color: #BA2121 } /* Literal.String.Delimiter */\n",
       ".cython .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */\n",
       ".cython .s2 { color: #BA2121 } /* Literal.String.Double */\n",
       ".cython .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */\n",
       ".cython .sh { color: #BA2121 } /* Literal.String.Heredoc */\n",
       ".cython .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */\n",
       ".cython .sx { color: #008000 } /* Literal.String.Other */\n",
       ".cython .sr { color: #A45A77 } /* Literal.String.Regex */\n",
       ".cython .s1 { color: #BA2121 } /* Literal.String.Single */\n",
       ".cython .ss { color: #19177C } /* Literal.String.Symbol */\n",
       ".cython .bp { color: #008000 } /* Name.Builtin.Pseudo */\n",
       ".cython .fm { color: #0000FF } /* Name.Function.Magic */\n",
       ".cython .vc { color: #19177C } /* Name.Variable.Class */\n",
       ".cython .vg { color: #19177C } /* Name.Variable.Global */\n",
       ".cython .vi { color: #19177C } /* Name.Variable.Instance */\n",
       ".cython .vm { color: #19177C } /* Name.Variable.Magic */\n",
       ".cython .il { color: #666666 } /* Literal.Number.Integer.Long */\n",
       "    </style>\n",
       "</head>\n",
       "<body class=\"cython\">\n",
       "<p><span style=\"border-bottom: solid 1px grey;\">Generated by Cython 3.0.3</span></p>\n",
       "<p>\n",
       "    <span style=\"background-color: #FFFF00\">Yellow lines</span> hint at Python interaction.<br />\n",
       "    Click on a line that starts with a \"<code>+</code>\" to see the C code that Cython generated for it.\n",
       "</p>\n",
       "<div class=\"cython\"><pre class=\"cython line score-16\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">1</span>: <span class=\"k\">import</span> <span class=\"nn\">random</span></pre>\n",
       "<pre class='cython code score-16 '>  __pyx_t_2 = <span class='pyx_c_api'>__Pyx_ImportDottedModule</span>(__pyx_n_s_random, NULL);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n",
       "  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_random, __pyx_t_2) &lt; 0) <span class='error_goto'>__PYX_ERR(0, 1, __pyx_L1_error)</span>\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n",
       "/* … */\n",
       "  __pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyDict_NewPresized</span>(0);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n",
       "  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_test, __pyx_t_2) &lt; 0) <span class='error_goto'>__PYX_ERR(0, 1, __pyx_L1_error)</span>\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n",
       "</pre><pre class=\"cython line score-59\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">2</span>: <span class=\"k\">def</span> <span class=\"nf\">average_cy1</span><span class=\"p\">(</span><span class=\"nb\">int</span> <span class=\"n\">n</span><span class=\"p\">):</span></pre>\n",
       "<pre class='cython code score-59 '>/* Python wrapper */\n",
       "static PyObject *__pyx_pw_54_cython_magic_34cab0d959aefb4fde3de70fe51382b812ea3f8d_1average_cy1(PyObject *__pyx_self, \n",
       "#if CYTHON_METH_FASTCALL\n",
       "PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds\n",
       "#else\n",
       "PyObject *__pyx_args, PyObject *__pyx_kwds\n",
       "#endif\n",
       "); /*proto*/\n",
       "static PyMethodDef __pyx_mdef_54_cython_magic_34cab0d959aefb4fde3de70fe51382b812ea3f8d_1average_cy1 = {\"average_cy1\", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_54_cython_magic_34cab0d959aefb4fde3de70fe51382b812ea3f8d_1average_cy1, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};\n",
       "static PyObject *__pyx_pw_54_cython_magic_34cab0d959aefb4fde3de70fe51382b812ea3f8d_1average_cy1(PyObject *__pyx_self, \n",
       "#if CYTHON_METH_FASTCALL\n",
       "PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds\n",
       "#else\n",
       "PyObject *__pyx_args, PyObject *__pyx_kwds\n",
       "#endif\n",
       ") {\n",
       "  int __pyx_v_n;\n",
       "  #if !CYTHON_METH_FASTCALL\n",
       "  CYTHON_UNUSED Py_ssize_t __pyx_nargs;\n",
       "  #endif\n",
       "  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;\n",
       "  PyObject *__pyx_r = 0;\n",
       "  <span class='refnanny'>__Pyx_RefNannyDeclarations</span>\n",
       "  <span class='refnanny'>__Pyx_RefNannySetupContext</span>(\"average_cy1 (wrapper)\", 0);\n",
       "  #if !CYTHON_METH_FASTCALL\n",
       "  #if CYTHON_ASSUME_SAFE_MACROS\n",
       "  __pyx_nargs = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args);\n",
       "  #else\n",
       "  __pyx_nargs = <span class='py_c_api'>PyTuple_Size</span>(__pyx_args); if (unlikely(__pyx_nargs &lt; 0)) return NULL;\n",
       "  #endif\n",
       "  #endif\n",
       "  __pyx_kwvalues = <span class='pyx_c_api'>__Pyx_KwValues_FASTCALL</span>(__pyx_args, __pyx_nargs);\n",
       "  {\n",
       "    PyObject **__pyx_pyargnames[] = {&amp;__pyx_n_s_n,0};\n",
       "  PyObject* values[1] = {0};\n",
       "    if (__pyx_kwds) {\n",
       "      Py_ssize_t kw_args;\n",
       "      switch (__pyx_nargs) {\n",
       "        case  1: values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);\n",
       "        CYTHON_FALLTHROUGH;\n",
       "        case  0: break;\n",
       "        default: goto __pyx_L5_argtuple_error;\n",
       "      }\n",
       "      kw_args = <span class='pyx_c_api'>__Pyx_NumKwargs_FASTCALL</span>(__pyx_kwds);\n",
       "      switch (__pyx_nargs) {\n",
       "        case  0:\n",
       "        if (likely((values[0] = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n)) != 0)) {\n",
       "          (void)<span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(values[0]);\n",
       "          kw_args--;\n",
       "        }\n",
       "        else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 2, __pyx_L3_error)</span>\n",
       "        else goto __pyx_L5_argtuple_error;\n",
       "      }\n",
       "      if (unlikely(kw_args &gt; 0)) {\n",
       "        const Py_ssize_t kwd_pos_args = __pyx_nargs;\n",
       "        if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, \"average_cy1\") &lt; 0)) <span class='error_goto'>__PYX_ERR(0, 2, __pyx_L3_error)</span>\n",
       "      }\n",
       "    } else if (unlikely(__pyx_nargs != 1)) {\n",
       "      goto __pyx_L5_argtuple_error;\n",
       "    } else {\n",
       "      values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);\n",
       "    }\n",
       "    __pyx_v_n = <span class='pyx_c_api'>__Pyx_PyInt_As_int</span>(values[0]); if (unlikely((__pyx_v_n == (int)-1) &amp;&amp; <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 2, __pyx_L3_error)</span>\n",
       "  }\n",
       "  goto __pyx_L6_skip;\n",
       "  __pyx_L5_argtuple_error:;\n",
       "  <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>(\"average_cy1\", 1, 1, 1, __pyx_nargs); <span class='error_goto'>__PYX_ERR(0, 2, __pyx_L3_error)</span>\n",
       "  __pyx_L6_skip:;\n",
       "  goto __pyx_L4_argument_unpacking_done;\n",
       "  __pyx_L3_error:;\n",
       "  {\n",
       "    Py_ssize_t __pyx_temp;\n",
       "    for (__pyx_temp=0; __pyx_temp &lt; (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {\n",
       "      <span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);\n",
       "    }\n",
       "  }\n",
       "  <span class='pyx_c_api'>__Pyx_AddTraceback</span>(\"_cython_magic_34cab0d959aefb4fde3de70fe51382b812ea3f8d.average_cy1\", __pyx_clineno, __pyx_lineno, __pyx_filename);\n",
       "  <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n",
       "  return NULL;\n",
       "  __pyx_L4_argument_unpacking_done:;\n",
       "  __pyx_r = __pyx_pf_54_cython_magic_34cab0d959aefb4fde3de70fe51382b812ea3f8d_average_cy1(__pyx_self, __pyx_v_n);\n",
       "  int __pyx_lineno = 0;\n",
       "  const char *__pyx_filename = NULL;\n",
       "  int __pyx_clineno = 0;\n",
       "\n",
       "  /* function exit code */\n",
       "  {\n",
       "    Py_ssize_t __pyx_temp;\n",
       "    for (__pyx_temp=0; __pyx_temp &lt; (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {\n",
       "      <span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);\n",
       "    }\n",
       "  }\n",
       "  <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n",
       "  return __pyx_r;\n",
       "}\n",
       "\n",
       "static PyObject *__pyx_pf_54_cython_magic_34cab0d959aefb4fde3de70fe51382b812ea3f8d_average_cy1(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_n) {\n",
       "  CYTHON_UNUSED int __pyx_v_i;\n",
       "  float __pyx_v_s;\n",
       "  PyObject *__pyx_r = NULL;\n",
       "/* … */\n",
       "  /* function exit code */\n",
       "  __pyx_L1_error:;\n",
       "  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4);\n",
       "  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_5);\n",
       "  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_6);\n",
       "  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_7);\n",
       "  <span class='pyx_c_api'>__Pyx_AddTraceback</span>(\"_cython_magic_34cab0d959aefb4fde3de70fe51382b812ea3f8d.average_cy1\", __pyx_clineno, __pyx_lineno, __pyx_filename);\n",
       "  __pyx_r = NULL;\n",
       "  __pyx_L0:;\n",
       "  <span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);\n",
       "  <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n",
       "  return __pyx_r;\n",
       "}\n",
       "/* … */\n",
       "  __pyx_tuple__2 = <span class='py_c_api'>PyTuple_Pack</span>(3, __pyx_n_s_n, __pyx_n_s_i, __pyx_n_s_s);<span class='error_goto'> if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 2, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_tuple__2);\n",
       "  <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_tuple__2);\n",
       "/* … */\n",
       "  __pyx_t_2 = <span class='pyx_c_api'>__Pyx_CyFunction_New</span>(&amp;__pyx_mdef_54_cython_magic_34cab0d959aefb4fde3de70fe51382b812ea3f8d_1average_cy1, 0, __pyx_n_s_average_cy1, NULL, __pyx_n_s_cython_magic_34cab0d959aefb4fde, __pyx_d, ((PyObject *)__pyx_codeobj__3));<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n",
       "  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_average_cy1, __pyx_t_2) &lt; 0) <span class='error_goto'>__PYX_ERR(0, 2, __pyx_L1_error)</span>\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n",
       "</pre><pre class=\"cython line score-0\">&#xA0;<span class=\"\">3</span>:     <span class=\"k\">cdef</span> <span class=\"kt\">int</span> <span class=\"nf\">i</span></pre>\n",
       "<pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">4</span>:     <span class=\"k\">cdef</span> <span class=\"kt\">float</span> <span class=\"nf\">s</span> <span class=\"o\">=</span> <span class=\"mf\">0</span></pre>\n",
       "<pre class='cython code score-0 '>  __pyx_v_s = 0.0;\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">5</span>:     <span class=\"k\">for</span> <span class=\"n\">i</span> <span class=\"ow\">in</span> <span class=\"nb\">range</span><span class=\"p\">(</span><span class=\"n\">n</span><span class=\"p\">):</span></pre>\n",
       "<pre class='cython code score-0 '>  __pyx_t_1 = __pyx_v_n;\n",
       "  __pyx_t_2 = __pyx_t_1;\n",
       "  for (__pyx_t_3 = 0; __pyx_t_3 &lt; __pyx_t_2; __pyx_t_3+=1) {\n",
       "    __pyx_v_i = __pyx_t_3;\n",
       "</pre><pre class=\"cython line score-42\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">6</span>:         <span class=\"n\">s</span> <span class=\"o\">+=</span> <span class=\"n\">random</span><span class=\"o\">.</span><span class=\"n\">random</span><span class=\"p\">()</span></pre>\n",
       "<pre class='cython code score-42 '>    __pyx_t_4 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_v_s);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 6, __pyx_L1_error)</span>\n",
       "    <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n",
       "    <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_6, __pyx_n_s_random);<span class='error_goto'> if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 6, __pyx_L1_error)</span>\n",
       "    <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n",
       "    __pyx_t_7 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_6, __pyx_n_s_random);<span class='error_goto'> if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 6, __pyx_L1_error)</span>\n",
       "    <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_7);\n",
       "    <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n",
       "    __pyx_t_6 = NULL;\n",
       "    __pyx_t_8 = 0;\n",
       "    #if CYTHON_UNPACK_METHODS\n",
       "    if (unlikely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_7))) {\n",
       "      __pyx_t_6 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_7);\n",
       "      if (likely(__pyx_t_6)) {\n",
       "        PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_7);\n",
       "        <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_6);\n",
       "        <span class='pyx_macro_api'>__Pyx_INCREF</span>(function);\n",
       "        <span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_7, function);\n",
       "        __pyx_t_8 = 1;\n",
       "      }\n",
       "    }\n",
       "    #endif\n",
       "    {\n",
       "      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};\n",
       "      __pyx_t_5 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8);\n",
       "      <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n",
       "      if (unlikely(!__pyx_t_5)) <span class='error_goto'>__PYX_ERR(0, 6, __pyx_L1_error)</span>\n",
       "      <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_5);\n",
       "      <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;\n",
       "    }\n",
       "    __pyx_t_7 = <span class='py_c_api'>PyNumber_InPlaceAdd</span>(__pyx_t_4, __pyx_t_5);<span class='error_goto'> if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 6, __pyx_L1_error)</span>\n",
       "    <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_7);\n",
       "    <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n",
       "    <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0;\n",
       "    __pyx_t_9 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_t_7); if (unlikely((__pyx_t_9 == (float)-1) &amp;&amp; <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 6, __pyx_L1_error)</span>\n",
       "    <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;\n",
       "    __pyx_v_s = __pyx_t_9;\n",
       "  }\n",
       "</pre><pre class=\"cython line score-11\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">7</span>:     <span class=\"k\">return</span> <span class=\"n\">s</span> <span class=\"o\">/</span> <span class=\"n\">n</span></pre>\n",
       "<pre class='cython code score-11 '>  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);\n",
       "  if (unlikely(__pyx_v_n == 0)) {\n",
       "    <span class='py_c_api'>PyErr_SetString</span>(PyExc_ZeroDivisionError, \"float division\");\n",
       "    <span class='error_goto'>__PYX_ERR(0, 7, __pyx_L1_error)</span>\n",
       "  }\n",
       "  __pyx_t_7 = <span class='py_c_api'>PyFloat_FromDouble</span>((__pyx_v_s / ((float)__pyx_v_n)));<span class='error_goto'> if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 7, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_7);\n",
       "  __pyx_r = __pyx_t_7;\n",
       "  __pyx_t_7 = 0;\n",
       "  goto __pyx_L0;\n",
       "</pre></div></body></html>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%%cython -a\n",
    "import random  \n",
    "def average_cy1(int n):  \n",
    "    cdef int i  \n",
    "    cdef float s = 0  \n",
    "    for i in range(n):\n",
    "        s += random.random()\n",
    "    return s / n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 352 ms, sys: 3.64 ms, total: 356 ms\n",
      "Wall time: 358 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.5001948475837708"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time average_cy1(n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "352 ms ± 2.12 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
     ]
    }
   ],
   "source": [
    "%timeit average_cy1(n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.3835020661354065\n",
      "0.5194163918495178\n",
      "0.8309653401374817\n",
      "0.03457210958003998\n",
      "0.05346163362264633\n"
     ]
    }
   ],
   "source": [
    "%%cython\n",
    "from libc.stdlib cimport rand  \n",
    "cdef extern from 'limits.h':  \n",
    "    int INT_MAX  \n",
    "cdef int i\n",
    "cdef float rn\n",
    "for i in range(5):\n",
    "    rn = rand() / INT_MAX  \n",
    "    print(rn)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<!-- Generated by Cython 3.0.3 -->\n",
       "<html>\n",
       "<head>\n",
       "    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n",
       "    <title>Cython: _cython_magic_9a65c99376fab3ce36394b8bb73dd16237d61669.pyx</title>\n",
       "    <style type=\"text/css\">\n",
       "    \n",
       "body.cython { font-family: courier; font-size: 12; }\n",
       "\n",
       ".cython.tag  {  }\n",
       ".cython.line { color: #000000; margin: 0em }\n",
       ".cython.code { font-size: 9; color: #444444; display: none; margin: 0px 0px 0px 8px; border-left: 8px none; }\n",
       "\n",
       ".cython.line .run { background-color: #B0FFB0; }\n",
       ".cython.line .mis { background-color: #FFB0B0; }\n",
       ".cython.code.run  { border-left: 8px solid #B0FFB0; }\n",
       ".cython.code.mis  { border-left: 8px solid #FFB0B0; }\n",
       "\n",
       ".cython.code .py_c_api  { color: red; }\n",
       ".cython.code .py_macro_api  { color: #FF7000; }\n",
       ".cython.code .pyx_c_api  { color: #FF3000; }\n",
       ".cython.code .pyx_macro_api  { color: #FF7000; }\n",
       ".cython.code .refnanny  { color: #FFA000; }\n",
       ".cython.code .trace  { color: #FFA000; }\n",
       ".cython.code .error_goto  { color: #FFA000; }\n",
       "\n",
       ".cython.code .coerce  { color: #008000; border: 1px dotted #008000 }\n",
       ".cython.code .py_attr { color: #FF0000; font-weight: bold; }\n",
       ".cython.code .c_attr  { color: #0000FF; }\n",
       ".cython.code .py_call { color: #FF0000; font-weight: bold; }\n",
       ".cython.code .c_call  { color: #0000FF; }\n",
       "\n",
       ".cython.score-0 {background-color: #FFFFff;}\n",
       ".cython.score-1 {background-color: #FFFFe7;}\n",
       ".cython.score-2 {background-color: #FFFFd4;}\n",
       ".cython.score-3 {background-color: #FFFFc4;}\n",
       ".cython.score-4 {background-color: #FFFFb6;}\n",
       ".cython.score-5 {background-color: #FFFFaa;}\n",
       ".cython.score-6 {background-color: #FFFF9f;}\n",
       ".cython.score-7 {background-color: #FFFF96;}\n",
       ".cython.score-8 {background-color: #FFFF8d;}\n",
       ".cython.score-9 {background-color: #FFFF86;}\n",
       ".cython.score-10 {background-color: #FFFF7f;}\n",
       ".cython.score-11 {background-color: #FFFF79;}\n",
       ".cython.score-12 {background-color: #FFFF73;}\n",
       ".cython.score-13 {background-color: #FFFF6e;}\n",
       ".cython.score-14 {background-color: #FFFF6a;}\n",
       ".cython.score-15 {background-color: #FFFF66;}\n",
       ".cython.score-16 {background-color: #FFFF62;}\n",
       ".cython.score-17 {background-color: #FFFF5e;}\n",
       ".cython.score-18 {background-color: #FFFF5b;}\n",
       ".cython.score-19 {background-color: #FFFF57;}\n",
       ".cython.score-20 {background-color: #FFFF55;}\n",
       ".cython.score-21 {background-color: #FFFF52;}\n",
       ".cython.score-22 {background-color: #FFFF4f;}\n",
       ".cython.score-23 {background-color: #FFFF4d;}\n",
       ".cython.score-24 {background-color: #FFFF4b;}\n",
       ".cython.score-25 {background-color: #FFFF48;}\n",
       ".cython.score-26 {background-color: #FFFF46;}\n",
       ".cython.score-27 {background-color: #FFFF44;}\n",
       ".cython.score-28 {background-color: #FFFF43;}\n",
       ".cython.score-29 {background-color: #FFFF41;}\n",
       ".cython.score-30 {background-color: #FFFF3f;}\n",
       ".cython.score-31 {background-color: #FFFF3e;}\n",
       ".cython.score-32 {background-color: #FFFF3c;}\n",
       ".cython.score-33 {background-color: #FFFF3b;}\n",
       ".cython.score-34 {background-color: #FFFF39;}\n",
       ".cython.score-35 {background-color: #FFFF38;}\n",
       ".cython.score-36 {background-color: #FFFF37;}\n",
       ".cython.score-37 {background-color: #FFFF36;}\n",
       ".cython.score-38 {background-color: #FFFF35;}\n",
       ".cython.score-39 {background-color: #FFFF34;}\n",
       ".cython.score-40 {background-color: #FFFF33;}\n",
       ".cython.score-41 {background-color: #FFFF32;}\n",
       ".cython.score-42 {background-color: #FFFF31;}\n",
       ".cython.score-43 {background-color: #FFFF30;}\n",
       ".cython.score-44 {background-color: #FFFF2f;}\n",
       ".cython.score-45 {background-color: #FFFF2e;}\n",
       ".cython.score-46 {background-color: #FFFF2d;}\n",
       ".cython.score-47 {background-color: #FFFF2c;}\n",
       ".cython.score-48 {background-color: #FFFF2b;}\n",
       ".cython.score-49 {background-color: #FFFF2b;}\n",
       ".cython.score-50 {background-color: #FFFF2a;}\n",
       ".cython.score-51 {background-color: #FFFF29;}\n",
       ".cython.score-52 {background-color: #FFFF29;}\n",
       ".cython.score-53 {background-color: #FFFF28;}\n",
       ".cython.score-54 {background-color: #FFFF27;}\n",
       ".cython.score-55 {background-color: #FFFF27;}\n",
       ".cython.score-56 {background-color: #FFFF26;}\n",
       ".cython.score-57 {background-color: #FFFF26;}\n",
       ".cython.score-58 {background-color: #FFFF25;}\n",
       ".cython.score-59 {background-color: #FFFF24;}\n",
       ".cython.score-60 {background-color: #FFFF24;}\n",
       ".cython.score-61 {background-color: #FFFF23;}\n",
       ".cython.score-62 {background-color: #FFFF23;}\n",
       ".cython.score-63 {background-color: #FFFF22;}\n",
       ".cython.score-64 {background-color: #FFFF22;}\n",
       ".cython.score-65 {background-color: #FFFF22;}\n",
       ".cython.score-66 {background-color: #FFFF21;}\n",
       ".cython.score-67 {background-color: #FFFF21;}\n",
       ".cython.score-68 {background-color: #FFFF20;}\n",
       ".cython.score-69 {background-color: #FFFF20;}\n",
       ".cython.score-70 {background-color: #FFFF1f;}\n",
       ".cython.score-71 {background-color: #FFFF1f;}\n",
       ".cython.score-72 {background-color: #FFFF1f;}\n",
       ".cython.score-73 {background-color: #FFFF1e;}\n",
       ".cython.score-74 {background-color: #FFFF1e;}\n",
       ".cython.score-75 {background-color: #FFFF1e;}\n",
       ".cython.score-76 {background-color: #FFFF1d;}\n",
       ".cython.score-77 {background-color: #FFFF1d;}\n",
       ".cython.score-78 {background-color: #FFFF1c;}\n",
       ".cython.score-79 {background-color: #FFFF1c;}\n",
       ".cython.score-80 {background-color: #FFFF1c;}\n",
       ".cython.score-81 {background-color: #FFFF1c;}\n",
       ".cython.score-82 {background-color: #FFFF1b;}\n",
       ".cython.score-83 {background-color: #FFFF1b;}\n",
       ".cython.score-84 {background-color: #FFFF1b;}\n",
       ".cython.score-85 {background-color: #FFFF1a;}\n",
       ".cython.score-86 {background-color: #FFFF1a;}\n",
       ".cython.score-87 {background-color: #FFFF1a;}\n",
       ".cython.score-88 {background-color: #FFFF1a;}\n",
       ".cython.score-89 {background-color: #FFFF19;}\n",
       ".cython.score-90 {background-color: #FFFF19;}\n",
       ".cython.score-91 {background-color: #FFFF19;}\n",
       ".cython.score-92 {background-color: #FFFF19;}\n",
       ".cython.score-93 {background-color: #FFFF18;}\n",
       ".cython.score-94 {background-color: #FFFF18;}\n",
       ".cython.score-95 {background-color: #FFFF18;}\n",
       ".cython.score-96 {background-color: #FFFF18;}\n",
       ".cython.score-97 {background-color: #FFFF17;}\n",
       ".cython.score-98 {background-color: #FFFF17;}\n",
       ".cython.score-99 {background-color: #FFFF17;}\n",
       ".cython.score-100 {background-color: #FFFF17;}\n",
       ".cython.score-101 {background-color: #FFFF16;}\n",
       ".cython.score-102 {background-color: #FFFF16;}\n",
       ".cython.score-103 {background-color: #FFFF16;}\n",
       ".cython.score-104 {background-color: #FFFF16;}\n",
       ".cython.score-105 {background-color: #FFFF16;}\n",
       ".cython.score-106 {background-color: #FFFF15;}\n",
       ".cython.score-107 {background-color: #FFFF15;}\n",
       ".cython.score-108 {background-color: #FFFF15;}\n",
       ".cython.score-109 {background-color: #FFFF15;}\n",
       ".cython.score-110 {background-color: #FFFF15;}\n",
       ".cython.score-111 {background-color: #FFFF15;}\n",
       ".cython.score-112 {background-color: #FFFF14;}\n",
       ".cython.score-113 {background-color: #FFFF14;}\n",
       ".cython.score-114 {background-color: #FFFF14;}\n",
       ".cython.score-115 {background-color: #FFFF14;}\n",
       ".cython.score-116 {background-color: #FFFF14;}\n",
       ".cython.score-117 {background-color: #FFFF14;}\n",
       ".cython.score-118 {background-color: #FFFF13;}\n",
       ".cython.score-119 {background-color: #FFFF13;}\n",
       ".cython.score-120 {background-color: #FFFF13;}\n",
       ".cython.score-121 {background-color: #FFFF13;}\n",
       ".cython.score-122 {background-color: #FFFF13;}\n",
       ".cython.score-123 {background-color: #FFFF13;}\n",
       ".cython.score-124 {background-color: #FFFF13;}\n",
       ".cython.score-125 {background-color: #FFFF12;}\n",
       ".cython.score-126 {background-color: #FFFF12;}\n",
       ".cython.score-127 {background-color: #FFFF12;}\n",
       ".cython.score-128 {background-color: #FFFF12;}\n",
       ".cython.score-129 {background-color: #FFFF12;}\n",
       ".cython.score-130 {background-color: #FFFF12;}\n",
       ".cython.score-131 {background-color: #FFFF12;}\n",
       ".cython.score-132 {background-color: #FFFF11;}\n",
       ".cython.score-133 {background-color: #FFFF11;}\n",
       ".cython.score-134 {background-color: #FFFF11;}\n",
       ".cython.score-135 {background-color: #FFFF11;}\n",
       ".cython.score-136 {background-color: #FFFF11;}\n",
       ".cython.score-137 {background-color: #FFFF11;}\n",
       ".cython.score-138 {background-color: #FFFF11;}\n",
       ".cython.score-139 {background-color: #FFFF11;}\n",
       ".cython.score-140 {background-color: #FFFF11;}\n",
       ".cython.score-141 {background-color: #FFFF10;}\n",
       ".cython.score-142 {background-color: #FFFF10;}\n",
       ".cython.score-143 {background-color: #FFFF10;}\n",
       ".cython.score-144 {background-color: #FFFF10;}\n",
       ".cython.score-145 {background-color: #FFFF10;}\n",
       ".cython.score-146 {background-color: #FFFF10;}\n",
       ".cython.score-147 {background-color: #FFFF10;}\n",
       ".cython.score-148 {background-color: #FFFF10;}\n",
       ".cython.score-149 {background-color: #FFFF10;}\n",
       ".cython.score-150 {background-color: #FFFF0f;}\n",
       ".cython.score-151 {background-color: #FFFF0f;}\n",
       ".cython.score-152 {background-color: #FFFF0f;}\n",
       ".cython.score-153 {background-color: #FFFF0f;}\n",
       ".cython.score-154 {background-color: #FFFF0f;}\n",
       ".cython.score-155 {background-color: #FFFF0f;}\n",
       ".cython.score-156 {background-color: #FFFF0f;}\n",
       ".cython.score-157 {background-color: #FFFF0f;}\n",
       ".cython.score-158 {background-color: #FFFF0f;}\n",
       ".cython.score-159 {background-color: #FFFF0f;}\n",
       ".cython.score-160 {background-color: #FFFF0f;}\n",
       ".cython.score-161 {background-color: #FFFF0e;}\n",
       ".cython.score-162 {background-color: #FFFF0e;}\n",
       ".cython.score-163 {background-color: #FFFF0e;}\n",
       ".cython.score-164 {background-color: #FFFF0e;}\n",
       ".cython.score-165 {background-color: #FFFF0e;}\n",
       ".cython.score-166 {background-color: #FFFF0e;}\n",
       ".cython.score-167 {background-color: #FFFF0e;}\n",
       ".cython.score-168 {background-color: #FFFF0e;}\n",
       ".cython.score-169 {background-color: #FFFF0e;}\n",
       ".cython.score-170 {background-color: #FFFF0e;}\n",
       ".cython.score-171 {background-color: #FFFF0e;}\n",
       ".cython.score-172 {background-color: #FFFF0e;}\n",
       ".cython.score-173 {background-color: #FFFF0d;}\n",
       ".cython.score-174 {background-color: #FFFF0d;}\n",
       ".cython.score-175 {background-color: #FFFF0d;}\n",
       ".cython.score-176 {background-color: #FFFF0d;}\n",
       ".cython.score-177 {background-color: #FFFF0d;}\n",
       ".cython.score-178 {background-color: #FFFF0d;}\n",
       ".cython.score-179 {background-color: #FFFF0d;}\n",
       ".cython.score-180 {background-color: #FFFF0d;}\n",
       ".cython.score-181 {background-color: #FFFF0d;}\n",
       ".cython.score-182 {background-color: #FFFF0d;}\n",
       ".cython.score-183 {background-color: #FFFF0d;}\n",
       ".cython.score-184 {background-color: #FFFF0d;}\n",
       ".cython.score-185 {background-color: #FFFF0d;}\n",
       ".cython.score-186 {background-color: #FFFF0d;}\n",
       ".cython.score-187 {background-color: #FFFF0c;}\n",
       ".cython.score-188 {background-color: #FFFF0c;}\n",
       ".cython.score-189 {background-color: #FFFF0c;}\n",
       ".cython.score-190 {background-color: #FFFF0c;}\n",
       ".cython.score-191 {background-color: #FFFF0c;}\n",
       ".cython.score-192 {background-color: #FFFF0c;}\n",
       ".cython.score-193 {background-color: #FFFF0c;}\n",
       ".cython.score-194 {background-color: #FFFF0c;}\n",
       ".cython.score-195 {background-color: #FFFF0c;}\n",
       ".cython.score-196 {background-color: #FFFF0c;}\n",
       ".cython.score-197 {background-color: #FFFF0c;}\n",
       ".cython.score-198 {background-color: #FFFF0c;}\n",
       ".cython.score-199 {background-color: #FFFF0c;}\n",
       ".cython.score-200 {background-color: #FFFF0c;}\n",
       ".cython.score-201 {background-color: #FFFF0c;}\n",
       ".cython.score-202 {background-color: #FFFF0c;}\n",
       ".cython.score-203 {background-color: #FFFF0b;}\n",
       ".cython.score-204 {background-color: #FFFF0b;}\n",
       ".cython.score-205 {background-color: #FFFF0b;}\n",
       ".cython.score-206 {background-color: #FFFF0b;}\n",
       ".cython.score-207 {background-color: #FFFF0b;}\n",
       ".cython.score-208 {background-color: #FFFF0b;}\n",
       ".cython.score-209 {background-color: #FFFF0b;}\n",
       ".cython.score-210 {background-color: #FFFF0b;}\n",
       ".cython.score-211 {background-color: #FFFF0b;}\n",
       ".cython.score-212 {background-color: #FFFF0b;}\n",
       ".cython.score-213 {background-color: #FFFF0b;}\n",
       ".cython.score-214 {background-color: #FFFF0b;}\n",
       ".cython.score-215 {background-color: #FFFF0b;}\n",
       ".cython.score-216 {background-color: #FFFF0b;}\n",
       ".cython.score-217 {background-color: #FFFF0b;}\n",
       ".cython.score-218 {background-color: #FFFF0b;}\n",
       ".cython.score-219 {background-color: #FFFF0b;}\n",
       ".cython.score-220 {background-color: #FFFF0b;}\n",
       ".cython.score-221 {background-color: #FFFF0b;}\n",
       ".cython.score-222 {background-color: #FFFF0a;}\n",
       ".cython.score-223 {background-color: #FFFF0a;}\n",
       ".cython.score-224 {background-color: #FFFF0a;}\n",
       ".cython.score-225 {background-color: #FFFF0a;}\n",
       ".cython.score-226 {background-color: #FFFF0a;}\n",
       ".cython.score-227 {background-color: #FFFF0a;}\n",
       ".cython.score-228 {background-color: #FFFF0a;}\n",
       ".cython.score-229 {background-color: #FFFF0a;}\n",
       ".cython.score-230 {background-color: #FFFF0a;}\n",
       ".cython.score-231 {background-color: #FFFF0a;}\n",
       ".cython.score-232 {background-color: #FFFF0a;}\n",
       ".cython.score-233 {background-color: #FFFF0a;}\n",
       ".cython.score-234 {background-color: #FFFF0a;}\n",
       ".cython.score-235 {background-color: #FFFF0a;}\n",
       ".cython.score-236 {background-color: #FFFF0a;}\n",
       ".cython.score-237 {background-color: #FFFF0a;}\n",
       ".cython.score-238 {background-color: #FFFF0a;}\n",
       ".cython.score-239 {background-color: #FFFF0a;}\n",
       ".cython.score-240 {background-color: #FFFF0a;}\n",
       ".cython.score-241 {background-color: #FFFF0a;}\n",
       ".cython.score-242 {background-color: #FFFF0a;}\n",
       ".cython.score-243 {background-color: #FFFF0a;}\n",
       ".cython.score-244 {background-color: #FFFF0a;}\n",
       ".cython.score-245 {background-color: #FFFF0a;}\n",
       ".cython.score-246 {background-color: #FFFF09;}\n",
       ".cython.score-247 {background-color: #FFFF09;}\n",
       ".cython.score-248 {background-color: #FFFF09;}\n",
       ".cython.score-249 {background-color: #FFFF09;}\n",
       ".cython.score-250 {background-color: #FFFF09;}\n",
       ".cython.score-251 {background-color: #FFFF09;}\n",
       ".cython.score-252 {background-color: #FFFF09;}\n",
       ".cython.score-253 {background-color: #FFFF09;}\n",
       ".cython.score-254 {background-color: #FFFF09;}\n",
       "pre { line-height: 125%; }\n",
       "td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }\n",
       "span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }\n",
       "td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }\n",
       "span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }\n",
       ".cython .hll { background-color: #ffffcc }\n",
       ".cython { background: #f8f8f8; }\n",
       ".cython .c { color: #3D7B7B; font-style: italic } /* Comment */\n",
       ".cython .err { border: 1px solid #FF0000 } /* Error */\n",
       ".cython .k { color: #008000; font-weight: bold } /* Keyword */\n",
       ".cython .o { color: #666666 } /* Operator */\n",
       ".cython .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */\n",
       ".cython .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */\n",
       ".cython .cp { color: #9C6500 } /* Comment.Preproc */\n",
       ".cython .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */\n",
       ".cython .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */\n",
       ".cython .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */\n",
       ".cython .gd { color: #A00000 } /* Generic.Deleted */\n",
       ".cython .ge { font-style: italic } /* Generic.Emph */\n",
       ".cython .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */\n",
       ".cython .gr { color: #E40000 } /* Generic.Error */\n",
       ".cython .gh { color: #000080; font-weight: bold } /* Generic.Heading */\n",
       ".cython .gi { color: #008400 } /* Generic.Inserted */\n",
       ".cython .go { color: #717171 } /* Generic.Output */\n",
       ".cython .gp { color: #000080; font-weight: bold } /* Generic.Prompt */\n",
       ".cython .gs { font-weight: bold } /* Generic.Strong */\n",
       ".cython .gu { color: #800080; font-weight: bold } /* Generic.Subheading */\n",
       ".cython .gt { color: #0044DD } /* Generic.Traceback */\n",
       ".cython .kc { color: #008000; font-weight: bold } /* Keyword.Constant */\n",
       ".cython .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */\n",
       ".cython .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */\n",
       ".cython .kp { color: #008000 } /* Keyword.Pseudo */\n",
       ".cython .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */\n",
       ".cython .kt { color: #B00040 } /* Keyword.Type */\n",
       ".cython .m { color: #666666 } /* Literal.Number */\n",
       ".cython .s { color: #BA2121 } /* Literal.String */\n",
       ".cython .na { color: #687822 } /* Name.Attribute */\n",
       ".cython .nb { color: #008000 } /* Name.Builtin */\n",
       ".cython .nc { color: #0000FF; font-weight: bold } /* Name.Class */\n",
       ".cython .no { color: #880000 } /* Name.Constant */\n",
       ".cython .nd { color: #AA22FF } /* Name.Decorator */\n",
       ".cython .ni { color: #717171; font-weight: bold } /* Name.Entity */\n",
       ".cython .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */\n",
       ".cython .nf { color: #0000FF } /* Name.Function */\n",
       ".cython .nl { color: #767600 } /* Name.Label */\n",
       ".cython .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */\n",
       ".cython .nt { color: #008000; font-weight: bold } /* Name.Tag */\n",
       ".cython .nv { color: #19177C } /* Name.Variable */\n",
       ".cython .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */\n",
       ".cython .w { color: #bbbbbb } /* Text.Whitespace */\n",
       ".cython .mb { color: #666666 } /* Literal.Number.Bin */\n",
       ".cython .mf { color: #666666 } /* Literal.Number.Float */\n",
       ".cython .mh { color: #666666 } /* Literal.Number.Hex */\n",
       ".cython .mi { color: #666666 } /* Literal.Number.Integer */\n",
       ".cython .mo { color: #666666 } /* Literal.Number.Oct */\n",
       ".cython .sa { color: #BA2121 } /* Literal.String.Affix */\n",
       ".cython .sb { color: #BA2121 } /* Literal.String.Backtick */\n",
       ".cython .sc { color: #BA2121 } /* Literal.String.Char */\n",
       ".cython .dl { color: #BA2121 } /* Literal.String.Delimiter */\n",
       ".cython .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */\n",
       ".cython .s2 { color: #BA2121 } /* Literal.String.Double */\n",
       ".cython .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */\n",
       ".cython .sh { color: #BA2121 } /* Literal.String.Heredoc */\n",
       ".cython .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */\n",
       ".cython .sx { color: #008000 } /* Literal.String.Other */\n",
       ".cython .sr { color: #A45A77 } /* Literal.String.Regex */\n",
       ".cython .s1 { color: #BA2121 } /* Literal.String.Single */\n",
       ".cython .ss { color: #19177C } /* Literal.String.Symbol */\n",
       ".cython .bp { color: #008000 } /* Name.Builtin.Pseudo */\n",
       ".cython .fm { color: #0000FF } /* Name.Function.Magic */\n",
       ".cython .vc { color: #19177C } /* Name.Variable.Class */\n",
       ".cython .vg { color: #19177C } /* Name.Variable.Global */\n",
       ".cython .vi { color: #19177C } /* Name.Variable.Instance */\n",
       ".cython .vm { color: #19177C } /* Name.Variable.Magic */\n",
       ".cython .il { color: #666666 } /* Literal.Number.Integer.Long */\n",
       "    </style>\n",
       "</head>\n",
       "<body class=\"cython\">\n",
       "<p><span style=\"border-bottom: solid 1px grey;\">Generated by Cython 3.0.3</span></p>\n",
       "<p>\n",
       "    <span style=\"background-color: #FFFF00\">Yellow lines</span> hint at Python interaction.<br />\n",
       "    Click on a line that starts with a \"<code>+</code>\" to see the C code that Cython generated for it.\n",
       "</p>\n",
       "<div class=\"cython\"><pre class=\"cython line score-8\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">1</span>: <span class=\"k\">from</span> <span class=\"nn\">libc.stdlib</span> <span class=\"k\">cimport</span> <span class=\"n\">rand</span></pre>\n",
       "<pre class='cython code score-8 '>  __pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyDict_NewPresized</span>(0);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n",
       "  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_test, __pyx_t_2) &lt; 0) <span class='error_goto'>__PYX_ERR(0, 1, __pyx_L1_error)</span>\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n",
       "</pre><pre class=\"cython line score-0\">&#xA0;<span class=\"\">2</span>: <span class=\"k\">cdef</span> <span class=\"kr\">extern</span> <span class=\"k\">from</span> <span class=\"s\">&#39;limits.h&#39;</span><span class=\"p\">:</span></pre>\n",
       "<pre class=\"cython line score-0\">&#xA0;<span class=\"\">3</span>:     <span class=\"nb\">int</span> <span class=\"n\">INT_MAX</span></pre>\n",
       "<pre class=\"cython line score-56\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">4</span>: <span class=\"k\">def</span> <span class=\"nf\">average_cy2</span><span class=\"p\">(</span><span class=\"nb\">int</span> <span class=\"n\">n</span><span class=\"p\">):</span></pre>\n",
       "<pre class='cython code score-56 '>/* Python wrapper */\n",
       "static PyObject *__pyx_pw_54_cython_magic_9a65c99376fab3ce36394b8bb73dd16237d61669_1average_cy2(PyObject *__pyx_self, \n",
       "#if CYTHON_METH_FASTCALL\n",
       "PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds\n",
       "#else\n",
       "PyObject *__pyx_args, PyObject *__pyx_kwds\n",
       "#endif\n",
       "); /*proto*/\n",
       "static PyMethodDef __pyx_mdef_54_cython_magic_9a65c99376fab3ce36394b8bb73dd16237d61669_1average_cy2 = {\"average_cy2\", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_54_cython_magic_9a65c99376fab3ce36394b8bb73dd16237d61669_1average_cy2, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};\n",
       "static PyObject *__pyx_pw_54_cython_magic_9a65c99376fab3ce36394b8bb73dd16237d61669_1average_cy2(PyObject *__pyx_self, \n",
       "#if CYTHON_METH_FASTCALL\n",
       "PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds\n",
       "#else\n",
       "PyObject *__pyx_args, PyObject *__pyx_kwds\n",
       "#endif\n",
       ") {\n",
       "  int __pyx_v_n;\n",
       "  #if !CYTHON_METH_FASTCALL\n",
       "  CYTHON_UNUSED Py_ssize_t __pyx_nargs;\n",
       "  #endif\n",
       "  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;\n",
       "  PyObject *__pyx_r = 0;\n",
       "  <span class='refnanny'>__Pyx_RefNannyDeclarations</span>\n",
       "  <span class='refnanny'>__Pyx_RefNannySetupContext</span>(\"average_cy2 (wrapper)\", 0);\n",
       "  #if !CYTHON_METH_FASTCALL\n",
       "  #if CYTHON_ASSUME_SAFE_MACROS\n",
       "  __pyx_nargs = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args);\n",
       "  #else\n",
       "  __pyx_nargs = <span class='py_c_api'>PyTuple_Size</span>(__pyx_args); if (unlikely(__pyx_nargs &lt; 0)) return NULL;\n",
       "  #endif\n",
       "  #endif\n",
       "  __pyx_kwvalues = <span class='pyx_c_api'>__Pyx_KwValues_FASTCALL</span>(__pyx_args, __pyx_nargs);\n",
       "  {\n",
       "    PyObject **__pyx_pyargnames[] = {&amp;__pyx_n_s_n,0};\n",
       "  PyObject* values[1] = {0};\n",
       "    if (__pyx_kwds) {\n",
       "      Py_ssize_t kw_args;\n",
       "      switch (__pyx_nargs) {\n",
       "        case  1: values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);\n",
       "        CYTHON_FALLTHROUGH;\n",
       "        case  0: break;\n",
       "        default: goto __pyx_L5_argtuple_error;\n",
       "      }\n",
       "      kw_args = <span class='pyx_c_api'>__Pyx_NumKwargs_FASTCALL</span>(__pyx_kwds);\n",
       "      switch (__pyx_nargs) {\n",
       "        case  0:\n",
       "        if (likely((values[0] = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n)) != 0)) {\n",
       "          (void)<span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(values[0]);\n",
       "          kw_args--;\n",
       "        }\n",
       "        else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 4, __pyx_L3_error)</span>\n",
       "        else goto __pyx_L5_argtuple_error;\n",
       "      }\n",
       "      if (unlikely(kw_args &gt; 0)) {\n",
       "        const Py_ssize_t kwd_pos_args = __pyx_nargs;\n",
       "        if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, \"average_cy2\") &lt; 0)) <span class='error_goto'>__PYX_ERR(0, 4, __pyx_L3_error)</span>\n",
       "      }\n",
       "    } else if (unlikely(__pyx_nargs != 1)) {\n",
       "      goto __pyx_L5_argtuple_error;\n",
       "    } else {\n",
       "      values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);\n",
       "    }\n",
       "    __pyx_v_n = <span class='pyx_c_api'>__Pyx_PyInt_As_int</span>(values[0]); if (unlikely((__pyx_v_n == (int)-1) &amp;&amp; <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 4, __pyx_L3_error)</span>\n",
       "  }\n",
       "  goto __pyx_L6_skip;\n",
       "  __pyx_L5_argtuple_error:;\n",
       "  <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>(\"average_cy2\", 1, 1, 1, __pyx_nargs); <span class='error_goto'>__PYX_ERR(0, 4, __pyx_L3_error)</span>\n",
       "  __pyx_L6_skip:;\n",
       "  goto __pyx_L4_argument_unpacking_done;\n",
       "  __pyx_L3_error:;\n",
       "  {\n",
       "    Py_ssize_t __pyx_temp;\n",
       "    for (__pyx_temp=0; __pyx_temp &lt; (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {\n",
       "      <span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);\n",
       "    }\n",
       "  }\n",
       "  <span class='pyx_c_api'>__Pyx_AddTraceback</span>(\"_cython_magic_9a65c99376fab3ce36394b8bb73dd16237d61669.average_cy2\", __pyx_clineno, __pyx_lineno, __pyx_filename);\n",
       "  <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n",
       "  return NULL;\n",
       "  __pyx_L4_argument_unpacking_done:;\n",
       "  __pyx_r = __pyx_pf_54_cython_magic_9a65c99376fab3ce36394b8bb73dd16237d61669_average_cy2(__pyx_self, __pyx_v_n);\n",
       "  int __pyx_lineno = 0;\n",
       "  const char *__pyx_filename = NULL;\n",
       "  int __pyx_clineno = 0;\n",
       "\n",
       "  /* function exit code */\n",
       "  {\n",
       "    Py_ssize_t __pyx_temp;\n",
       "    for (__pyx_temp=0; __pyx_temp &lt; (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {\n",
       "      <span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);\n",
       "    }\n",
       "  }\n",
       "  <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n",
       "  return __pyx_r;\n",
       "}\n",
       "\n",
       "static PyObject *__pyx_pf_54_cython_magic_9a65c99376fab3ce36394b8bb73dd16237d61669_average_cy2(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_n) {\n",
       "  CYTHON_UNUSED int __pyx_v_i;\n",
       "  float __pyx_v_s;\n",
       "  PyObject *__pyx_r = NULL;\n",
       "/* … */\n",
       "  /* function exit code */\n",
       "  __pyx_L1_error:;\n",
       "  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_5);\n",
       "  <span class='pyx_c_api'>__Pyx_AddTraceback</span>(\"_cython_magic_9a65c99376fab3ce36394b8bb73dd16237d61669.average_cy2\", __pyx_clineno, __pyx_lineno, __pyx_filename);\n",
       "  __pyx_r = NULL;\n",
       "  __pyx_L0:;\n",
       "  <span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);\n",
       "  <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n",
       "  return __pyx_r;\n",
       "}\n",
       "/* … */\n",
       "  __pyx_tuple_ = <span class='py_c_api'>PyTuple_Pack</span>(3, __pyx_n_s_n, __pyx_n_s_i, __pyx_n_s_s);<span class='error_goto'> if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 4, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_tuple_);\n",
       "  <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_tuple_);\n",
       "/* … */\n",
       "  __pyx_t_2 = <span class='pyx_c_api'>__Pyx_CyFunction_New</span>(&amp;__pyx_mdef_54_cython_magic_9a65c99376fab3ce36394b8bb73dd16237d61669_1average_cy2, 0, __pyx_n_s_average_cy2, NULL, __pyx_n_s_cython_magic_9a65c99376fab3ce36, __pyx_d, ((PyObject *)__pyx_codeobj__2));<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n",
       "  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_average_cy2, __pyx_t_2) &lt; 0) <span class='error_goto'>__PYX_ERR(0, 4, __pyx_L1_error)</span>\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n",
       "</pre><pre class=\"cython line score-0\">&#xA0;<span class=\"\">5</span>:     <span class=\"k\">cdef</span> <span class=\"kt\">int</span> <span class=\"nf\">i</span></pre>\n",
       "<pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">6</span>:     <span class=\"k\">cdef</span> <span class=\"kt\">float</span> <span class=\"nf\">s</span> <span class=\"o\">=</span> <span class=\"mf\">0</span></pre>\n",
       "<pre class='cython code score-0 '>  __pyx_v_s = 0.0;\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">7</span>:     <span class=\"k\">for</span> <span class=\"n\">i</span> <span class=\"ow\">in</span> <span class=\"nb\">range</span><span class=\"p\">(</span><span class=\"n\">n</span><span class=\"p\">):</span></pre>\n",
       "<pre class='cython code score-0 '>  __pyx_t_1 = __pyx_v_n;\n",
       "  __pyx_t_2 = __pyx_t_1;\n",
       "  for (__pyx_t_3 = 0; __pyx_t_3 &lt; __pyx_t_2; __pyx_t_3+=1) {\n",
       "    __pyx_v_i = __pyx_t_3;\n",
       "</pre><pre class=\"cython line score-5\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">8</span>:         <span class=\"n\">s</span> <span class=\"o\">+=</span> <span class=\"n\">rand</span><span class=\"p\">()</span> <span class=\"o\">/</span> <span class=\"n\">INT_MAX</span></pre>\n",
       "<pre class='cython code score-5 '>    __pyx_t_4 = rand();\n",
       "    if (unlikely(INT_MAX == 0)) {\n",
       "      <span class='py_c_api'>PyErr_SetString</span>(PyExc_ZeroDivisionError, \"float division\");\n",
       "      <span class='error_goto'>__PYX_ERR(0, 8, __pyx_L1_error)</span>\n",
       "    }\n",
       "    __pyx_v_s = (__pyx_v_s + (((double)__pyx_t_4) / ((double)INT_MAX)));\n",
       "  }\n",
       "</pre><pre class=\"cython line score-11\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">9</span>:     <span class=\"k\">return</span> <span class=\"n\">s</span> <span class=\"o\">/</span> <span class=\"n\">n</span></pre>\n",
       "<pre class='cython code score-11 '>  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);\n",
       "  if (unlikely(__pyx_v_n == 0)) {\n",
       "    <span class='py_c_api'>PyErr_SetString</span>(PyExc_ZeroDivisionError, \"float division\");\n",
       "    <span class='error_goto'>__PYX_ERR(0, 9, __pyx_L1_error)</span>\n",
       "  }\n",
       "  __pyx_t_5 = <span class='py_c_api'>PyFloat_FromDouble</span>((__pyx_v_s / ((float)__pyx_v_n)));<span class='error_goto'> if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 9, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_5);\n",
       "  __pyx_r = __pyx_t_5;\n",
       "  __pyx_t_5 = 0;\n",
       "  goto __pyx_L0;\n",
       "</pre></div></body></html>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%%cython -a\n",
    "from libc.stdlib cimport rand  \n",
    "cdef extern from 'limits.h':  \n",
    "    int INT_MAX  \n",
    "def average_cy2(int n):\n",
    "    cdef int i\n",
    "    cdef float s = 0\n",
    "    for i in range(n):\n",
    "        s += rand() / INT_MAX  \n",
    "    return s / n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 71.1 ms, sys: 1.01 ms, total: 72.1 ms\n",
      "Wall time: 72.1 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.500017523765564"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time average_cy2(n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "71.7 ms ± 390 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
     ]
    }
   ],
   "source": [
    "%timeit average_cy2(n)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Prime Numbers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Pure Python"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "def is_prime(I):\n",
    "    if I % 2 == 0: return False  \n",
    "    for i in range(3, int(I ** 0.5) + 1, 2):  \n",
    "        if I % i == 0: return False  \n",
    "    return True  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "100000003"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "n = int(1e8 + 3)  \n",
    "n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 13 µs, sys: 0 ns, total: 13 µs\n",
      "Wall time: 15 µs\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time is_prime(n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "100000007"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p1 = int(1e8 + 7)  \n",
    "p1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 154 µs, sys: 0 ns, total: 154 µs\n",
      "Wall time: 156 µs\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time is_prime(p1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "p2 = 100109100129162907  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "57"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p2.bit_length()  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 6.67 s, sys: 30.5 ms, total: 6.7 s\n",
      "Wall time: 6.7 s\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time is_prime(p2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Numba"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "is_prime_nb = numba.jit(is_prime, nopython=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 40.6 ms, sys: 1.65 ms, total: 42.2 ms\n",
      "Wall time: 41.6 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time is_prime_nb(n)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 4 µs, sys: 1 µs, total: 5 µs\n",
      "Wall time: 5.01 µs\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time is_prime_nb(n)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 6 µs, sys: 1 µs, total: 7 µs\n",
      "Wall time: 8.11 µs\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time is_prime_nb(p1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 112 ms, sys: 1.29 ms, total: 113 ms\n",
      "Wall time: 114 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time is_prime_nb(p2)  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Cython"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%cython\n",
    "def is_prime_cy1(I):\n",
    "    if I % 2 == 0: return False\n",
    "    for i in range(3, int(I ** 0.5) + 1, 2):\n",
    "        if I % i == 0: return False\n",
    "    return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "141 µs ± 734 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n"
     ]
    }
   ],
   "source": [
    "%timeit is_prime(p1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "89.7 µs ± 141 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n"
     ]
    }
   ],
   "source": [
    "%timeit is_prime_cy1(p1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%cython\n",
    "def is_prime_cy2(long I):  \n",
    "    cdef long i  \n",
    "    if I % 2 == 0: return False\n",
    "    for i in range(3, int(I ** 0.5) + 1, 2):\n",
    "        if I % i == 0: return False\n",
    "    return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4.7 µs ± 3.55 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)\n"
     ]
    }
   ],
   "source": [
    "%timeit is_prime_cy2(p1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 112 ms, sys: 1.03 ms, total: 113 ms\n",
      "Wall time: 112 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time is_prime_nb(p2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 146 ms, sys: 1.02 ms, total: 147 ms\n",
      "Wall time: 146 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time is_prime_cy2(p2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Multiprocessing"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [],
   "source": [
    "import multiprocessing as mp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [],
   "source": [
    "# pool = mp.Pool(processes=4)  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<b style=\"color: red;\">This currently does not work on Macs with Apple Silicon.</b>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [],
   "source": [
    "# %time pool.map(is_prime, 10 * [p1])  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [],
   "source": [
    "# %time pool.map(is_prime_nb, 10 * [p2])  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "# %time pool.map(is_prime_cy2, 10 * [p2])  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Fibonacci Numbers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Recursive Algorithm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [],
   "source": [
    "from numba import njit"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [],
   "source": [
    "def fib_rec_py1(n):\n",
    "    if n < 2:\n",
    "        return n\n",
    "    else:\n",
    "        return fib_rec_py1(n - 1) + fib_rec_py1(n - 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 1.76 s, sys: 5.83 ms, total: 1.76 s\n",
      "Wall time: 1.76 s\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "9227465"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time fib_rec_py1(35)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "@njit\n",
    "def fib_rec_nb(n):\n",
    "    if n < 2:\n",
    "        return n\n",
    "    else:\n",
    "        return fib_rec_nb(n - 1) + fib_rec_nb(n - 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 73.7 ms, sys: 1.66 ms, total: 75.3 ms\n",
      "Wall time: 88.3 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "9227465"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time fib_rec_nb(35)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 40.2 ms, sys: 327 µs, total: 40.5 ms\n",
      "Wall time: 40.6 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "9227465"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time fib_rec_nb(35)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%cython\n",
    "def fib_rec_cy(int n):\n",
    "    if n < 2:\n",
    "        return n\n",
    "    else:\n",
    "        return fib_rec_cy(n - 1) + fib_rec_cy(n - 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 427 ms, sys: 3.42 ms, total: 430 ms\n",
      "Wall time: 429 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "9227465"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time fib_rec_cy(35)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [],
   "source": [
    "from functools import lru_cache as cache"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [],
   "source": [
    "@cache(maxsize=None)  \n",
    "def fib_rec_py2(n):\n",
    "    if n < 2:\n",
    "        return n\n",
    "    else:\n",
    "        return fib_rec_py2(n - 1) + fib_rec_py2(n - 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 11 µs, sys: 1 µs, total: 12 µs\n",
      "Wall time: 11.9 µs\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "9227465"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time fib_rec_py2(35)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 12 µs, sys: 0 ns, total: 12 µs\n",
      "Wall time: 13.1 µs\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "23416728348467685"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time fib_rec_py2(80)  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Iterative Algorithm "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [],
   "source": [
    "def fib_it_py(n):\n",
    "    x, y = 0, 1\n",
    "    for i in range(1, n + 1):\n",
    "        x, y = y, x + y\n",
    "    return x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 4 µs, sys: 1 µs, total: 5 µs\n",
      "Wall time: 6.2 µs\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "23416728348467685"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time fib_it_py(80)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [],
   "source": [
    "fib_it_nb = numba.jit(fib_it_py)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 29.7 ms, sys: 1.57 ms, total: 31.2 ms\n",
      "Wall time: 31.9 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "23416728348467685"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time fib_it_nb(80)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 3 µs, sys: 0 ns, total: 3 µs\n",
      "Wall time: 5.25 µs\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "23416728348467685"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time fib_it_nb(80)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%cython\n",
    "def fib_it_cy1(int n):\n",
    "    cdef long i\n",
    "    cdef long x = 0, y = 1\n",
    "    for i in range(1, n + 1):\n",
    "        x, y = y, x + y\n",
    "    return x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 2 µs, sys: 1e+03 ns, total: 3 µs\n",
      "Wall time: 2.62 µs\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "23416728348467685"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time fib_it_cy1(80)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "9969216677189303386214405760200\n",
      "CPU times: user 46 µs, sys: 4 µs, total: 50 µs\n",
      "Wall time: 49.8 µs\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "fn = fib_rec_py2(150)  \n",
    "print(fn)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "103"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fn.bit_length()  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6792540214324356296\n",
      "CPU times: user 96 µs, sys: 40 µs, total: 136 µs\n",
      "Wall time: 130 µs\n"
     ]
    }
   ],
   "source": [
    "%%time \n",
    "fn = fib_it_nb(150)  \n",
    "print(fn)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "63"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fn.bit_length()  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6792540214324356296\n",
      "CPU times: user 150 µs, sys: 94 µs, total: 244 µs\n",
      "Wall time: 223 µs\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "fn = fib_it_cy1(150)  \n",
    "print(fn)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "63"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fn.bit_length()  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%cython\n",
    "cdef extern from *:\n",
    "    ctypedef int int128 '__int128_t'  \n",
    "def fib_it_cy2(int n):\n",
    "    cdef int128 i  \n",
    "    cdef int128 x = 0, y = 1  \n",
    "    for i in range(1, n + 1):\n",
    "        x, y = y, x + y\n",
    "    return x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "9969216677189303386214405760200\n",
      "CPU times: user 22 µs, sys: 3 µs, total: 25 µs\n",
      "Wall time: 28.1 µs\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "fn = fib_it_cy2(150)  \n",
    "print(fn)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "103"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fn.bit_length()  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## The Number Pi"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The code example is taken from [StackExchange](https://codereview.stackexchange.com/questions/69370/monte-carlo-pi-calculation)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [],
   "source": [
    "import random\n",
    "import numpy as np\n",
    "from pylab import mpl, plt\n",
    "plt.style.use('seaborn-v0_8')\n",
    "mpl.rcParams['font.family'] = 'serif'\n",
    "%config InlineBackend.figure_format = 'svg'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [],
   "source": [
    "rn = [(random.random() * 2 - 1, random.random() * 2 - 1)\n",
    "      for _ in range(500)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-0.74105495,  0.21659404],\n",
       "       [ 0.29533552,  0.27454952],\n",
       "       [-0.90091177, -0.06116347],\n",
       "       [ 0.22191044,  0.65726317],\n",
       "       [-0.65071162,  0.26046397]])"
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rn = np.array(rn)\n",
    "rn[:5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(-1.1, 1.1)"
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"442.645312pt\" height=\"419.158125pt\" viewBox=\"0 0 442.645312 419.158125\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2023-10-15T07:42:49.070200</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.8.0, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 419.158125 \n",
       "L 442.645312 419.158125 \n",
       "L 442.645312 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 44.845313 395.28 \n",
       "L 435.445312 395.28 \n",
       "L 435.445312 7.2 \n",
       "L 44.845313 7.2 \n",
       "z\n",
       "\" style=\"fill: #eaeaf2\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <path d=\"M 62.599858 395.28 \n",
       "L 62.599858 7.2 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_2\"/>\n",
       "     <g id=\"text_1\">\n",
       "      <!-- −1.00 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(47.277202 409.878437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-2212\" d=\"M 678 2259 \n",
       "L 4684 2259 \n",
       "L 4684 1753 \n",
       "L 678 1753 \n",
       "L 678 2259 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSerif-31\" d=\"M 909 0 \n",
       "L 909 331 \n",
       "L 1722 331 \n",
       "L 1722 4213 \n",
       "L 781 3603 \n",
       "L 781 4013 \n",
       "L 1919 4750 \n",
       "L 2350 4750 \n",
       "L 2350 331 \n",
       "L 3163 331 \n",
       "L 3163 0 \n",
       "L 909 0 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSerif-2e\" d=\"M 603 325 \n",
       "Q 603 500 722 622 \n",
       "Q 841 744 1019 744 \n",
       "Q 1191 744 1312 622 \n",
       "Q 1434 500 1434 325 \n",
       "Q 1434 153 1312 31 \n",
       "Q 1191 -91 1019 -91 \n",
       "Q 841 -91 722 29 \n",
       "Q 603 150 603 325 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSerif-30\" d=\"M 2034 219 \n",
       "Q 2513 219 2750 744 \n",
       "Q 2988 1269 2988 2328 \n",
       "Q 2988 3391 2750 3916 \n",
       "Q 2513 4441 2034 4441 \n",
       "Q 1556 4441 1318 3916 \n",
       "Q 1081 3391 1081 2328 \n",
       "Q 1081 1269 1318 744 \n",
       "Q 1556 219 2034 219 \n",
       "z\n",
       "M 2034 -91 \n",
       "Q 1275 -91 848 546 \n",
       "Q 422 1184 422 2328 \n",
       "Q 422 3475 848 4112 \n",
       "Q 1275 4750 2034 4750 \n",
       "Q 2797 4750 3222 4112 \n",
       "Q 3647 3475 3647 2328 \n",
       "Q 3647 1184 3222 546 \n",
       "Q 2797 -91 2034 -91 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\" x=\"83.789062\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"147.412109\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"179.199219\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"242.822266\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <path d=\"M 106.986222 395.28 \n",
       "L 106.986222 7.2 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_4\"/>\n",
       "     <g id=\"text_2\">\n",
       "      <!-- −0.75 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(91.663565 409.878437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-37\" d=\"M 3609 4347 \n",
       "L 1784 0 \n",
       "L 1319 0 \n",
       "L 3059 4153 \n",
       "L 903 4153 \n",
       "L 903 3578 \n",
       "L 538 3578 \n",
       "L 538 4666 \n",
       "L 3609 4666 \n",
       "L 3609 4347 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSerif-35\" d=\"M 3219 4666 \n",
       "L 3219 4153 \n",
       "L 1081 4153 \n",
       "L 1081 2816 \n",
       "Q 1244 2928 1461 2984 \n",
       "Q 1678 3041 1947 3041 \n",
       "Q 2703 3041 3140 2622 \n",
       "Q 3578 2203 3578 1478 \n",
       "Q 3578 738 3136 323 \n",
       "Q 2694 -91 1894 -91 \n",
       "Q 1572 -91 1234 -12 \n",
       "Q 897 66 544 225 \n",
       "L 544 1131 \n",
       "L 897 1131 \n",
       "Q 925 688 1179 453 \n",
       "Q 1434 219 1894 219 \n",
       "Q 2388 219 2653 544 \n",
       "Q 2919 869 2919 1478 \n",
       "Q 2919 2084 2655 2407 \n",
       "Q 2391 2731 1894 2731 \n",
       "Q 1613 2731 1398 2631 \n",
       "Q 1184 2531 1019 2322 \n",
       "L 750 2322 \n",
       "L 750 4666 \n",
       "L 3219 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"83.789062\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"147.412109\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-37\" x=\"179.199219\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-35\" x=\"242.822266\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <path d=\"M 151.372585 395.28 \n",
       "L 151.372585 7.2 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_6\"/>\n",
       "     <g id=\"text_3\">\n",
       "      <!-- −0.50 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(136.049929 409.878437) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"83.789062\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"147.412109\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-35\" x=\"179.199219\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"242.822266\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <path d=\"M 195.758949 395.28 \n",
       "L 195.758949 7.2 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_8\"/>\n",
       "     <g id=\"text_4\">\n",
       "      <!-- −0.25 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(180.436293 409.878437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-32\" d=\"M 819 3553 \n",
       "L 469 3553 \n",
       "L 469 4384 \n",
       "Q 803 4563 1142 4656 \n",
       "Q 1481 4750 1806 4750 \n",
       "Q 2534 4750 2956 4397 \n",
       "Q 3378 4044 3378 3438 \n",
       "Q 3378 2753 2422 1800 \n",
       "Q 2347 1728 2309 1691 \n",
       "L 1131 513 \n",
       "L 3078 513 \n",
       "L 3078 1088 \n",
       "L 3444 1088 \n",
       "L 3444 0 \n",
       "L 434 0 \n",
       "L 434 341 \n",
       "L 1850 1753 \n",
       "Q 2319 2222 2519 2614 \n",
       "Q 2719 3006 2719 3438 \n",
       "Q 2719 3909 2473 4175 \n",
       "Q 2228 4441 1797 4441 \n",
       "Q 1350 4441 1106 4219 \n",
       "Q 863 3997 819 3553 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"83.789062\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"147.412109\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-32\" x=\"179.199219\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-35\" x=\"242.822266\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <path d=\"M 240.145313 395.28 \n",
       "L 240.145313 7.2 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_10\"/>\n",
       "     <g id=\"text_5\">\n",
       "      <!-- 0.00 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(229.0125 409.878437) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"159.033203\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_6\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <path d=\"M 284.531676 395.28 \n",
       "L 284.531676 7.2 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_12\"/>\n",
       "     <g id=\"text_6\">\n",
       "      <!-- 0.25 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(273.398864 409.878437) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-32\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-35\" x=\"159.033203\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_7\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <path d=\"M 328.91804 395.28 \n",
       "L 328.91804 7.2 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_14\"/>\n",
       "     <g id=\"text_7\">\n",
       "      <!-- 0.50 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(317.785227 409.878437) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-35\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"159.033203\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_8\">\n",
       "     <g id=\"line2d_15\">\n",
       "      <path d=\"M 373.304403 395.28 \n",
       "L 373.304403 7.2 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_16\"/>\n",
       "     <g id=\"text_8\">\n",
       "      <!-- 0.75 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(362.171591 409.878437) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-37\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-35\" x=\"159.033203\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_9\">\n",
       "     <g id=\"line2d_17\">\n",
       "      <path d=\"M 417.690767 395.28 \n",
       "L 417.690767 7.2 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_18\"/>\n",
       "     <g id=\"text_9\">\n",
       "      <!-- 1.00 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(406.557955 409.878437) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-31\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"159.033203\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_19\">\n",
       "      <path d=\"M 44.845313 377.64 \n",
       "L 435.445312 377.64 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_20\"/>\n",
       "     <g id=\"text_10\">\n",
       "      <!-- −1.00 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(7.2 381.439219) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\" x=\"83.789062\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"147.412109\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"179.199219\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"242.822266\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_21\">\n",
       "      <path d=\"M 44.845313 333.54 \n",
       "L 435.445312 333.54 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_22\"/>\n",
       "     <g id=\"text_11\">\n",
       "      <!-- −0.75 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(7.2 337.339219) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"83.789062\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"147.412109\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-37\" x=\"179.199219\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-35\" x=\"242.822266\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_23\">\n",
       "      <path d=\"M 44.845313 289.44 \n",
       "L 435.445312 289.44 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_24\"/>\n",
       "     <g id=\"text_12\">\n",
       "      <!-- −0.50 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(7.2 293.239219) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"83.789062\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"147.412109\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-35\" x=\"179.199219\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"242.822266\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_25\">\n",
       "      <path d=\"M 44.845313 245.34 \n",
       "L 435.445312 245.34 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_26\"/>\n",
       "     <g id=\"text_13\">\n",
       "      <!-- −0.25 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(7.2 249.139219) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"83.789062\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"147.412109\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-32\" x=\"179.199219\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-35\" x=\"242.822266\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_27\">\n",
       "      <path d=\"M 44.845313 201.24 \n",
       "L 435.445312 201.24 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_28\"/>\n",
       "     <g id=\"text_14\">\n",
       "      <!-- 0.00 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(15.579688 205.039219) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"159.033203\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_29\">\n",
       "      <path d=\"M 44.845313 157.14 \n",
       "L 435.445312 157.14 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_30\"/>\n",
       "     <g id=\"text_15\">\n",
       "      <!-- 0.25 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(15.579688 160.939219) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-32\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-35\" x=\"159.033203\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_7\">\n",
       "     <g id=\"line2d_31\">\n",
       "      <path d=\"M 44.845313 113.04 \n",
       "L 435.445312 113.04 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_32\"/>\n",
       "     <g id=\"text_16\">\n",
       "      <!-- 0.50 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(15.579688 116.839219) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-35\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"159.033203\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_8\">\n",
       "     <g id=\"line2d_33\">\n",
       "      <path d=\"M 44.845313 68.94 \n",
       "L 435.445312 68.94 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_34\"/>\n",
       "     <g id=\"text_17\">\n",
       "      <!-- 0.75 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(15.579688 72.739219) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-37\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-35\" x=\"159.033203\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_9\">\n",
       "     <g id=\"line2d_35\">\n",
       "      <path d=\"M 44.845313 24.84 \n",
       "L 435.445312 24.84 \n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_36\"/>\n",
       "     <g id=\"text_18\">\n",
       "      <!-- 1.00 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(15.579688 28.639219) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-31\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"159.033203\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 240.145313 377.64 \n",
       "C 287.230917 377.64 332.394357 359.053383 365.688907 325.973636 \n",
       "C 398.983458 292.893889 417.690767 248.021827 417.690767 201.24 \n",
       "C 417.690767 154.458173 398.983458 109.586111 365.688907 76.506364 \n",
       "C 332.394357 43.426617 287.230917 24.84 240.145313 24.84 \n",
       "C 193.059708 24.84 147.896268 43.426617 114.601718 76.506364 \n",
       "C 81.307167 109.586111 62.599858 154.458173 62.599858 201.24 \n",
       "C 62.599858 248.021827 81.307167 292.893889 114.601718 325.973636 \n",
       "C 147.896268 359.053383 193.059708 377.64 240.145313 377.64 \n",
       "L 240.145313 377.64 \n",
       "z\n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: none; stroke: #008000; stroke-width: 2; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 62.599858 377.64 \n",
       "L 417.690767 377.64 \n",
       "L 417.690767 24.84 \n",
       "L 62.599858 24.84 \n",
       "z\n",
       "\" clip-path=\"url(#p458512264d)\" style=\"fill: #4c72b0; opacity: 0.3; stroke: #0000ff; stroke-width: 0.3; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_37\">\n",
       "    <defs>\n",
       "     <path id=\"m36c83339b0\" d=\"M 0 1.75 \n",
       "C 0.464105 1.75 0.909265 1.565609 1.237437 1.237437 \n",
       "C 1.565609 0.909265 1.75 0.464105 1.75 0 \n",
       "C 1.75 -0.464105 1.565609 -0.909265 1.237437 -1.237437 \n",
       "C 0.909265 -1.565609 0.464105 -1.75 0 -1.75 \n",
       "C -0.464105 -1.75 -0.909265 -1.565609 -1.237437 -1.237437 \n",
       "C -1.565609 -0.909265 -1.75 -0.464105 -1.75 0 \n",
       "C -1.75 0.464105 -1.565609 0.909265 -1.237437 1.237437 \n",
       "C -0.909265 1.565609 -0.464105 1.75 0 1.75 \n",
       "z\n",
       "\"/>\n",
       "    </defs>\n",
       "    <g clip-path=\"url(#p458512264d)\">\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"108.574374\" y=\"163.032812\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"292.580792\" y=\"152.809464\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"80.192523\" y=\"212.029236\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"279.544503\" y=\"85.298777\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"124.614422\" y=\"155.294157\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"160.095283\" y=\"30.068038\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"319.028437\" y=\"212.660032\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"359.295775\" y=\"278.452877\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"190.237641\" y=\"178.003193\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"371.72699\" y=\"201.636271\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"224.373613\" y=\"114.343417\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"223.421157\" y=\"230.078117\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"270.271567\" y=\"268.922052\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"142.290348\" y=\"355.811148\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"402.679005\" y=\"128.866409\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"217.049551\" y=\"181.524877\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"257.094729\" y=\"98.472998\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"212.248982\" y=\"158.629559\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"302.213352\" y=\"59.793622\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"154.82939\" y=\"72.626502\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"225.473835\" y=\"173.018595\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"100.422286\" y=\"313.622657\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"190.923571\" y=\"249.670319\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"73.751611\" y=\"187.544575\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"96.290175\" y=\"168.858667\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"355.441721\" y=\"49.033452\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"122.270767\" y=\"48.300638\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"89.674228\" y=\"55.517157\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"264.575361\" y=\"132.261727\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"101.070345\" y=\"45.823896\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"299.524607\" y=\"55.051222\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"329.399076\" y=\"158.336256\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"64.242851\" y=\"247.319931\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"386.927824\" y=\"333.671083\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"209.469015\" y=\"275.076084\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"410.652776\" y=\"95.06611\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"69.919912\" y=\"322.376984\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"396.135343\" y=\"354.653444\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"329.181782\" y=\"250.555844\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"393.015319\" y=\"222.598119\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"144.033502\" y=\"119.213212\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"369.270016\" y=\"245.500018\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"232.239802\" y=\"194.264104\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"147.582619\" y=\"47.897772\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"323.675987\" y=\"340.727826\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"69.176505\" y=\"66.480517\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"77.364535\" y=\"358.561808\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"197.36091\" y=\"141.165483\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"341.33345\" y=\"223.710574\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"332.844001\" y=\"59.292127\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"67.327974\" y=\"196.660526\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"157.395951\" y=\"188.578045\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"251.12064\" y=\"106.169763\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"310.913452\" y=\"235.867472\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"138.095839\" y=\"110.04148\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"389.167031\" y=\"41.785063\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"172.394356\" y=\"176.184424\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"95.489237\" y=\"342.646513\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"107.429571\" y=\"277.389059\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"87.542583\" y=\"322.794388\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"212.269017\" y=\"283.674529\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"96.439264\" y=\"79.089226\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"348.771857\" y=\"227.094645\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"224.433407\" y=\"254.055739\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"79.11762\" y=\"54.074729\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"140.681227\" y=\"191.437432\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"161.158558\" y=\"338.84433\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"334.0234\" y=\"322.698498\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"367.173488\" y=\"113.982186\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"109.830624\" y=\"136.457998\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"365.412595\" y=\"187.904519\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"103.21748\" y=\"356.348244\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"399.42163\" y=\"121.116492\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"331.502141\" y=\"148.679006\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"103.40324\" y=\"302.520872\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"398.309265\" y=\"239.044547\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"380.22779\" y=\"239.813996\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"189.153657\" y=\"156.271389\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"338.760304\" y=\"180.653183\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"135.431426\" y=\"193.189444\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"386.10747\" y=\"96.945713\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"114.153888\" y=\"331.142395\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"369.112544\" y=\"214.33047\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"389.797056\" y=\"202.517161\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"107.107668\" y=\"152.202893\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"124.511703\" y=\"69.346911\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"215.537361\" y=\"124.492719\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"297.445154\" y=\"81.074166\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"281.986571\" y=\"339.655093\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"331.340135\" y=\"124.860381\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"303.247341\" y=\"176.89252\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"187.197448\" y=\"232.964714\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"137.061308\" y=\"49.031385\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"243.6432\" y=\"305.357549\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"317.279603\" y=\"197.873186\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"235.021525\" y=\"56.248304\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"106.672883\" y=\"258.061478\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"135.208404\" y=\"273.458206\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"333.43667\" y=\"277.537062\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"298.083122\" y=\"94.014609\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"98.36922\" y=\"103.294464\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"255.35498\" y=\"87.86526\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"303.445782\" y=\"243.730218\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"199.360904\" y=\"297.41687\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"290.900354\" y=\"264.835653\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"203.452233\" y=\"350.829977\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"215.437907\" y=\"302.687657\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"128.492576\" y=\"278.57064\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"414.457915\" y=\"145.139918\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"254.384271\" y=\"133.029577\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"350.529659\" y=\"251.814937\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"385.143536\" y=\"349.379127\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"214.980928\" y=\"188.716652\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"277.3208\" y=\"255.728189\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"370.467164\" y=\"300.677826\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"147.900253\" y=\"131.829887\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"168.24831\" y=\"359.952176\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"229.772797\" y=\"304.694252\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"294.291212\" y=\"193.651616\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"212.551436\" y=\"84.540021\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"382.401898\" y=\"45.029611\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"347.107786\" y=\"253.418686\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"279.736732\" y=\"344.851374\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"151.566725\" y=\"125.98661\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"350.295502\" y=\"275.00476\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"391.972263\" y=\"317.008553\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"120.309349\" y=\"177.725222\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"221.052628\" y=\"300.986169\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"168.000501\" y=\"354.29068\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"259.315026\" y=\"164.359572\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"178.007015\" y=\"285.822238\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"205.074187\" y=\"277.061005\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"212.077372\" y=\"60.629776\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"371.772731\" y=\"368.726523\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"261.178291\" y=\"375.887023\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"88.458566\" y=\"48.636232\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"157.458827\" y=\"37.840822\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"321.603448\" y=\"303.262324\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"81.329291\" y=\"72.534594\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"216.167089\" y=\"233.791837\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"334.15776\" y=\"295.122342\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"66.729942\" y=\"262.512754\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"184.69444\" y=\"271.207388\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"251.42095\" y=\"236.646379\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"300.143158\" y=\"198.002132\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"351.667236\" y=\"293.119537\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"248.060833\" y=\"170.029871\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"142.80214\" y=\"129.557352\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"412.610551\" y=\"261.86203\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"88.790512\" y=\"73.471308\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"327.837436\" y=\"197.487916\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"231.823422\" y=\"197.521616\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"338.967269\" y=\"195.410859\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"245.47027\" y=\"189.088194\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"404.502107\" y=\"368.386802\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"203.65469\" y=\"348.611915\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"294.038397\" y=\"231.910986\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"414.568889\" y=\"218.587483\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"107.405474\" y=\"56.849492\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"124.719028\" y=\"350.732898\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"378.880384\" y=\"45.751733\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"394.127703\" y=\"122.528409\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"167.351006\" y=\"374.581816\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"359.084197\" y=\"243.480157\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"173.885737\" y=\"158.012909\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"339.9339\" y=\"294.190576\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"409.118477\" y=\"322.650867\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"227.390789\" y=\"238.848416\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"177.841535\" y=\"317.377195\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"226.373135\" y=\"330.915026\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"234.881146\" y=\"310.616798\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"138.419754\" y=\"293.164863\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"121.308857\" y=\"171.479796\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"311.643905\" y=\"250.626465\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"85.245385\" y=\"287.661068\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"166.347021\" y=\"185.193377\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"91.756632\" y=\"161.032242\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"269.976496\" y=\"158.465447\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"254.44942\" y=\"205.123118\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"407.619848\" y=\"91.657026\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"244.424856\" y=\"173.017914\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"105.928978\" y=\"327.130929\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"188.260725\" y=\"264.096618\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"417.316286\" y=\"46.521711\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"229.468584\" y=\"282.05303\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"416.133834\" y=\"96.186744\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"273.33641\" y=\"110.791338\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"272.949447\" y=\"183.380203\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"196.800582\" y=\"52.785322\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"191.330541\" y=\"366.126096\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"210.313128\" y=\"108.895572\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"180.840849\" y=\"139.847611\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"291.09516\" y=\"147.295371\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"335.041376\" y=\"157.555161\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"142.234141\" y=\"312.966895\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"295.856731\" y=\"150.711038\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"404.850835\" y=\"29.829389\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"349.192585\" y=\"295.048997\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"154.603798\" y=\"256.615719\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"333.623125\" y=\"105.578204\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"284.780868\" y=\"275.691861\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"339.80574\" y=\"348.548563\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"233.588874\" y=\"101.488043\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"139.076112\" y=\"353.061189\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"221.660413\" y=\"125.918207\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"129.81144\" y=\"259.320362\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"83.501042\" y=\"183.233922\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"376.272123\" y=\"273.152212\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"314.561244\" y=\"124.699035\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"312.131388\" y=\"65.069316\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"133.063846\" y=\"312.094755\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"266.454754\" y=\"206.506252\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"338.780911\" y=\"304.223196\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"81.714053\" y=\"250.960773\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"135.778412\" y=\"139.166111\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"152.507462\" y=\"77.360838\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"152.005825\" y=\"170.940257\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"150.746448\" y=\"243.73816\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"326.937677\" y=\"243.495059\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"153.094302\" y=\"71.135958\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"80.999543\" y=\"216.110737\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"229.814374\" y=\"157.378342\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"62.992853\" y=\"64.541899\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"151.886626\" y=\"46.155308\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"157.797471\" y=\"118.6022\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"280.149026\" y=\"138.401901\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"136.619397\" y=\"357.609861\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"190.448413\" y=\"189.84268\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"304.006125\" y=\"254.915607\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"124.702275\" y=\"228.031932\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"383.284179\" y=\"330.495743\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"319.667391\" y=\"76.525596\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"70.835953\" y=\"38.817951\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"164.086626\" y=\"282.006775\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"239.210045\" y=\"185.204877\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"388.54513\" y=\"242.683379\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"221.957801\" y=\"210.049817\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"112.144053\" y=\"321.710725\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"98.633296\" y=\"244.575622\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"79.373598\" y=\"157.103773\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"199.436109\" y=\"244.054986\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"321.115541\" y=\"93.125142\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"151.376855\" y=\"306.801336\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"416.866472\" y=\"186.938209\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"183.669043\" y=\"217.76095\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"248.747421\" y=\"56.113707\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"280.721133\" y=\"95.333956\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"301.218627\" y=\"193.312927\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"106.002699\" y=\"229.494341\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"172.640583\" y=\"154.112086\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"312.925675\" y=\"101.628285\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"310.685202\" y=\"374.298289\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"77.939327\" y=\"309.893674\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"249.259659\" y=\"351.538923\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"281.012641\" y=\"39.746566\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"210.154281\" y=\"287.457843\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"209.445201\" y=\"152.661227\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"257.936214\" y=\"85.539757\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"356.781961\" y=\"187.392903\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"212.884361\" y=\"145.091014\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"197.191431\" y=\"84.852929\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"151.363554\" y=\"247.515104\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"313.225226\" y=\"279.434962\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"262.903521\" y=\"92.106413\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"363.211658\" y=\"369.76707\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"338.843679\" y=\"129.706664\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"207.059824\" y=\"321.358063\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"90.828491\" y=\"167.740077\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"216.713811\" y=\"86.591581\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"163.306768\" y=\"351.778725\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"183.762165\" y=\"216.995299\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"314.150241\" y=\"360.385708\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"131.67345\" y=\"338.857425\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"352.015953\" y=\"45.652095\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"202.341054\" y=\"290.042867\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"80.650969\" y=\"213.810351\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"94.925528\" y=\"196.34061\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"408.103839\" y=\"349.258206\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"284.179895\" y=\"275.958616\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"355.064843\" y=\"109.006274\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"262.522881\" y=\"160.816985\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"290.312318\" y=\"281.923007\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"322.146491\" y=\"151.030133\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"388.370224\" y=\"172.221605\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"318.61827\" y=\"139.353043\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"379.267496\" y=\"177.487743\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"329.373744\" y=\"207.263022\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"112.686015\" y=\"176.799315\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"227.996151\" y=\"346.159071\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"239.766629\" y=\"162.129457\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"248.576277\" y=\"243.010947\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"128.77012\" y=\"39.878703\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"123.585988\" y=\"84.118806\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"305.321003\" y=\"320.71295\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"118.525078\" y=\"316.235336\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"377.774462\" y=\"51.127533\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"400.443891\" y=\"77.584368\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"121.900512\" y=\"275.982047\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"111.97378\" y=\"263.790345\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"357.032835\" y=\"315.436179\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"81.339546\" y=\"177.381474\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"272.721808\" y=\"181.980999\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"325.583972\" y=\"195.83242\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"323.83078\" y=\"159.297413\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"314.390404\" y=\"134.684409\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"389.851716\" y=\"321.005078\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"328.637802\" y=\"97.063542\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"260.03965\" y=\"320.011045\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"413.32176\" y=\"28.839544\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"246.94272\" y=\"336.009743\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"298.136511\" y=\"138.516083\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"400.161346\" y=\"361.108908\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"122.441568\" y=\"319.504659\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"157.026305\" y=\"226.24691\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"242.000104\" y=\"129.454436\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"64.956894\" y=\"29.215128\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"68.338956\" y=\"227.619573\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"319.184342\" y=\"206.346989\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"131.757952\" y=\"360.725558\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"277.951436\" y=\"278.255374\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"262.122286\" y=\"97.61935\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"369.050791\" y=\"87.923815\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"294.578493\" y=\"223.59822\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"246.006802\" y=\"374.978471\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"156.92079\" y=\"70.521099\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"72.273248\" y=\"165.292545\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"233.737792\" y=\"92.766391\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"271.62415\" y=\"156.260978\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"348.86785\" y=\"276.382887\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"164.214345\" y=\"229.859708\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"394.585424\" y=\"114.061496\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"81.663147\" y=\"183.656591\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"244.744683\" y=\"373.5599\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"379.246265\" y=\"189.800272\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"231.89034\" y=\"333.20828\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"215.296264\" y=\"130.558491\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"290.396696\" y=\"28.078105\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"117.385969\" y=\"162.123376\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"389.473161\" y=\"284.607767\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"105.477206\" y=\"115.545966\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"322.815552\" y=\"145.724244\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"315.759292\" y=\"322.777359\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"298.205706\" y=\"115.580026\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"136.277875\" y=\"158.84694\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"223.609009\" y=\"38.668471\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"120.111514\" y=\"90.049388\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"383.853663\" y=\"38.222128\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"328.362984\" y=\"285.106242\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"287.730298\" y=\"334.182932\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"122.385049\" y=\"281.856902\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"118.92373\" y=\"243.202659\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"264.24413\" y=\"298.542762\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"209.458587\" y=\"339.062792\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"346.347975\" y=\"190.788397\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"348.610284\" y=\"84.130071\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"182.513617\" y=\"147.153487\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"97.407049\" y=\"160.336567\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"166.785503\" y=\"197.032066\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"103.486985\" y=\"116.141077\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"416.806297\" y=\"371.457078\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"356.775425\" y=\"322.432741\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"352.138312\" y=\"363.146355\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"155.576453\" y=\"307.305815\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"180.78324\" y=\"36.285644\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"93.584891\" y=\"59.946159\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"71.754993\" y=\"97.425519\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"65.920565\" y=\"271.36876\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"412.411886\" y=\"245.523014\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"176.075009\" y=\"26.199285\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"249.947058\" y=\"186.030911\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"404.825613\" y=\"29.201494\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"408.994111\" y=\"376.363471\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"154.98896\" y=\"54.850144\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"164.820165\" y=\"49.713478\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"205.493921\" y=\"352.674521\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"175.614155\" y=\"319.456228\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"400.141904\" y=\"196.125886\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"289.928987\" y=\"133.658792\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"303.282704\" y=\"47.29819\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"261.155302\" y=\"145.690702\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"266.444967\" y=\"133.831692\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"407.041412\" y=\"142.927568\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"190.398613\" y=\"318.730215\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"142.860119\" y=\"200.496209\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"313.052526\" y=\"294.915043\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"298.337074\" y=\"159.236607\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"115.663423\" y=\"370.813219\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"363.789592\" y=\"208.017954\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"249.276846\" y=\"177.725565\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"268.553887\" y=\"243.789513\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"133.53674\" y=\"40.203409\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"200.388687\" y=\"156.331805\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"66.520695\" y=\"132.626668\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"349.966692\" y=\"227.99244\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"121.958343\" y=\"309.838729\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"327.826365\" y=\"274.206334\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"274.319459\" y=\"270.131154\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"402.315055\" y=\"179.298823\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"203.978919\" y=\"107.029287\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"349.240967\" y=\"154.233817\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"147.294882\" y=\"337.649469\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"80.938967\" y=\"55.753173\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"205.956224\" y=\"271.594975\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"227.869908\" y=\"64.970102\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"167.412743\" y=\"82.638336\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"94.208691\" y=\"188.943502\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"96.96682\" y=\"34.260051\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"94.036908\" y=\"151.258607\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"246.827913\" y=\"61.682948\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"213.172451\" y=\"106.55955\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"160.289793\" y=\"249.721776\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"89.578564\" y=\"238.670247\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"416.684582\" y=\"133.630238\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"361.780264\" y=\"328.140909\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"134.337809\" y=\"104.074296\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"164.423626\" y=\"294.747473\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"193.288941\" y=\"316.428691\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"275.925628\" y=\"48.758217\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"335.976994\" y=\"237.053112\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"313.733537\" y=\"357.31273\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"307.882085\" y=\"250.909195\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"373.199483\" y=\"324.060156\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"162.811214\" y=\"163.494464\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"199.286475\" y=\"88.881803\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"377.777373\" y=\"125.854252\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"332.779402\" y=\"254.086564\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"353.270806\" y=\"260.072841\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"381.55175\" y=\"281.383569\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"186.59172\" y=\"37.025945\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"156.571364\" y=\"119.214439\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"197.381927\" y=\"143.846663\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"287.632063\" y=\"216.866978\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"169.222577\" y=\"353.587645\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"177.44625\" y=\"138.545566\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"142.1294\" y=\"357.405631\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"112.381006\" y=\"225.312974\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"331.453833\" y=\"301.11259\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"392.560866\" y=\"242.226901\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"264.619846\" y=\"154.826867\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"376.245373\" y=\"49.124595\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"217.763623\" y=\"48.782408\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"303.585941\" y=\"315.720052\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"139.266524\" y=\"84.934029\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"346.900008\" y=\"66.595313\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"349.153882\" y=\"246.973248\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"390.645188\" y=\"148.599422\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"199.565837\" y=\"180.647067\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"367.701328\" y=\"237.124095\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"394.598251\" y=\"275.934114\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"250.87386\" y=\"133.260776\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"413.880033\" y=\"273.790579\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"382.180869\" y=\"33.543477\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"184.282838\" y=\"30.692979\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"130.708241\" y=\"283.751577\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"363.652793\" y=\"145.285088\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"212.819046\" y=\"197.880105\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"208.43245\" y=\"73.22746\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"311.450347\" y=\"375.095492\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"148.130592\" y=\"116.589727\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"191.126328\" y=\"66.859456\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"285.935497\" y=\"181.43396\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"400.435727\" y=\"328.591376\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"308.78001\" y=\"28.394768\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"93.696832\" y=\"112.801794\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"282.401351\" y=\"54.455856\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"400.101438\" y=\"63.056329\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"213.581722\" y=\"294.527192\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"232.372847\" y=\"176.660934\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"220.449189\" y=\"100.839283\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"81.603313\" y=\"53.700435\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"404.946217\" y=\"154.420562\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"163.835247\" y=\"90.156603\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"117.14556\" y=\"286.006025\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"211.666027\" y=\"163.333177\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"161.933354\" y=\"125.622259\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"189.276308\" y=\"232.495064\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"185.656302\" y=\"244.893964\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"374.873712\" y=\"227.149202\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"164.776779\" y=\"272.071184\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"251.231881\" y=\"74.30906\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"411.178257\" y=\"55.97845\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"123.160918\" y=\"329.254513\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"135.076088\" y=\"44.759245\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"159.874431\" y=\"216.658428\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"75.067164\" y=\"277.306119\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"158.870744\" y=\"352.364225\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"404.389234\" y=\"96.695307\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"264.088356\" y=\"343.923269\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"288.090155\" y=\"323.955556\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"210.623056\" y=\"240.577293\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"249.940258\" y=\"256.181474\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"296.661958\" y=\"168.529629\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"286.634421\" y=\"155.298494\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"95.395458\" y=\"333.427624\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"286.850977\" y=\"221.991187\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"231.512496\" y=\"131.426264\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"83.160816\" y=\"340.902429\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"297.81872\" y=\"248.515851\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"300.569697\" y=\"131.460357\" style=\"fill: #ff0000\"/>\n",
       "     <use xlink:href=\"#m36c83339b0\" x=\"132.886855\" y=\"224.240294\" style=\"fill: #ff0000\"/>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 44.845313 395.28 \n",
       "L 44.845313 7.2 \n",
       "\" style=\"fill: none\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 435.445312 395.28 \n",
       "L 435.445312 7.2 \n",
       "\" style=\"fill: none\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_7\">\n",
       "    <path d=\"M 44.845312 395.28 \n",
       "L 435.445313 395.28 \n",
       "\" style=\"fill: none\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_8\">\n",
       "    <path d=\"M 44.845312 7.2 \n",
       "L 435.445313 7.2 \n",
       "\" style=\"fill: none\"/>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p458512264d\">\n",
       "   <rect x=\"44.845313\" y=\"7.2\" width=\"390.6\" height=\"388.08\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 700x700 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure(figsize=(7, 7))\n",
    "ax = fig.add_subplot(1, 1, 1)\n",
    "circ = plt.Circle((0, 0), radius=1, edgecolor='g', lw=2.0,\n",
    "                  facecolor='None')  \n",
    "box = plt.Rectangle((-1, -1), 2, 2, edgecolor='b', alpha=0.3)  \n",
    "ax.add_patch(circ)  \n",
    "ax.add_patch(box)  \n",
    "plt.plot(rn[:, 0], rn[:, 1], 'r.')  \n",
    "plt.ylim(-1.1, 1.1)\n",
    "plt.xlim(-1.1, 1.1)\n",
    "# plt.savefig('../../images/ch10/perf_01.png');"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [],
   "source": [
    "n = int(1e7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 81.8 ms, sys: 15.6 ms, total: 97.3 ms\n",
      "Wall time: 110 ms\n"
     ]
    }
   ],
   "source": [
    "%time rn = np.random.random((n, 2)) * 2 - 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "160000000"
      ]
     },
     "execution_count": 85,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rn.nbytes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 72.8 ms, sys: 46.5 ms, total: 119 ms\n",
      "Wall time: 134 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([0.429, 0.894, 0.904, 0.651, 1.076, 0.301, 1.011, 0.402])"
      ]
     },
     "execution_count": 86,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time distance = np.sqrt((rn ** 2).sum(axis=1))  \n",
    "distance[:8].round(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 5.7 ms, sys: 2.59 ms, total: 8.29 ms\n",
      "Wall time: 7.08 ms\n"
     ]
    }
   ],
   "source": [
    "%time frac = (distance <= 1.0).sum() / len(distance)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3.1422068"
      ]
     },
     "execution_count": 88,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pi_mcs = frac * 4  \n",
    "pi_mcs  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [],
   "source": [
    "def mcs_pi_py(n):\n",
    "    circle = 0\n",
    "    for _ in range(n):\n",
    "        x, y = random.random(), random.random()\n",
    "        if (x ** 2 + y ** 2) ** 0.5 <= 1:\n",
    "            circle += 1\n",
    "    return (4 * circle) / n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 2.09 s, sys: 6.1 ms, total: 2.1 s\n",
      "Wall time: 2.1 s\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "3.141862"
      ]
     },
     "execution_count": 90,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time mcs_pi_py(n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {},
   "outputs": [],
   "source": [
    "mcs_pi_nb = numba.jit(mcs_pi_py)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 179 ms, sys: 5.51 ms, total: 185 ms\n",
      "Wall time: 187 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "3.1419856"
      ]
     },
     "execution_count": 92,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time mcs_pi_nb(n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 47.4 ms, sys: 508 µs, total: 47.9 ms\n",
      "Wall time: 48 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "3.141478"
      ]
     },
     "execution_count": 93,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time mcs_pi_nb(n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<!-- Generated by Cython 3.0.3 -->\n",
       "<html>\n",
       "<head>\n",
       "    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n",
       "    <title>Cython: _cython_magic_a2c59b961c02fc4401b9f868fa2d9e4bbd64e802.pyx</title>\n",
       "    <style type=\"text/css\">\n",
       "    \n",
       "body.cython { font-family: courier; font-size: 12; }\n",
       "\n",
       ".cython.tag  {  }\n",
       ".cython.line { color: #000000; margin: 0em }\n",
       ".cython.code { font-size: 9; color: #444444; display: none; margin: 0px 0px 0px 8px; border-left: 8px none; }\n",
       "\n",
       ".cython.line .run { background-color: #B0FFB0; }\n",
       ".cython.line .mis { background-color: #FFB0B0; }\n",
       ".cython.code.run  { border-left: 8px solid #B0FFB0; }\n",
       ".cython.code.mis  { border-left: 8px solid #FFB0B0; }\n",
       "\n",
       ".cython.code .py_c_api  { color: red; }\n",
       ".cython.code .py_macro_api  { color: #FF7000; }\n",
       ".cython.code .pyx_c_api  { color: #FF3000; }\n",
       ".cython.code .pyx_macro_api  { color: #FF7000; }\n",
       ".cython.code .refnanny  { color: #FFA000; }\n",
       ".cython.code .trace  { color: #FFA000; }\n",
       ".cython.code .error_goto  { color: #FFA000; }\n",
       "\n",
       ".cython.code .coerce  { color: #008000; border: 1px dotted #008000 }\n",
       ".cython.code .py_attr { color: #FF0000; font-weight: bold; }\n",
       ".cython.code .c_attr  { color: #0000FF; }\n",
       ".cython.code .py_call { color: #FF0000; font-weight: bold; }\n",
       ".cython.code .c_call  { color: #0000FF; }\n",
       "\n",
       ".cython.score-0 {background-color: #FFFFff;}\n",
       ".cython.score-1 {background-color: #FFFFe7;}\n",
       ".cython.score-2 {background-color: #FFFFd4;}\n",
       ".cython.score-3 {background-color: #FFFFc4;}\n",
       ".cython.score-4 {background-color: #FFFFb6;}\n",
       ".cython.score-5 {background-color: #FFFFaa;}\n",
       ".cython.score-6 {background-color: #FFFF9f;}\n",
       ".cython.score-7 {background-color: #FFFF96;}\n",
       ".cython.score-8 {background-color: #FFFF8d;}\n",
       ".cython.score-9 {background-color: #FFFF86;}\n",
       ".cython.score-10 {background-color: #FFFF7f;}\n",
       ".cython.score-11 {background-color: #FFFF79;}\n",
       ".cython.score-12 {background-color: #FFFF73;}\n",
       ".cython.score-13 {background-color: #FFFF6e;}\n",
       ".cython.score-14 {background-color: #FFFF6a;}\n",
       ".cython.score-15 {background-color: #FFFF66;}\n",
       ".cython.score-16 {background-color: #FFFF62;}\n",
       ".cython.score-17 {background-color: #FFFF5e;}\n",
       ".cython.score-18 {background-color: #FFFF5b;}\n",
       ".cython.score-19 {background-color: #FFFF57;}\n",
       ".cython.score-20 {background-color: #FFFF55;}\n",
       ".cython.score-21 {background-color: #FFFF52;}\n",
       ".cython.score-22 {background-color: #FFFF4f;}\n",
       ".cython.score-23 {background-color: #FFFF4d;}\n",
       ".cython.score-24 {background-color: #FFFF4b;}\n",
       ".cython.score-25 {background-color: #FFFF48;}\n",
       ".cython.score-26 {background-color: #FFFF46;}\n",
       ".cython.score-27 {background-color: #FFFF44;}\n",
       ".cython.score-28 {background-color: #FFFF43;}\n",
       ".cython.score-29 {background-color: #FFFF41;}\n",
       ".cython.score-30 {background-color: #FFFF3f;}\n",
       ".cython.score-31 {background-color: #FFFF3e;}\n",
       ".cython.score-32 {background-color: #FFFF3c;}\n",
       ".cython.score-33 {background-color: #FFFF3b;}\n",
       ".cython.score-34 {background-color: #FFFF39;}\n",
       ".cython.score-35 {background-color: #FFFF38;}\n",
       ".cython.score-36 {background-color: #FFFF37;}\n",
       ".cython.score-37 {background-color: #FFFF36;}\n",
       ".cython.score-38 {background-color: #FFFF35;}\n",
       ".cython.score-39 {background-color: #FFFF34;}\n",
       ".cython.score-40 {background-color: #FFFF33;}\n",
       ".cython.score-41 {background-color: #FFFF32;}\n",
       ".cython.score-42 {background-color: #FFFF31;}\n",
       ".cython.score-43 {background-color: #FFFF30;}\n",
       ".cython.score-44 {background-color: #FFFF2f;}\n",
       ".cython.score-45 {background-color: #FFFF2e;}\n",
       ".cython.score-46 {background-color: #FFFF2d;}\n",
       ".cython.score-47 {background-color: #FFFF2c;}\n",
       ".cython.score-48 {background-color: #FFFF2b;}\n",
       ".cython.score-49 {background-color: #FFFF2b;}\n",
       ".cython.score-50 {background-color: #FFFF2a;}\n",
       ".cython.score-51 {background-color: #FFFF29;}\n",
       ".cython.score-52 {background-color: #FFFF29;}\n",
       ".cython.score-53 {background-color: #FFFF28;}\n",
       ".cython.score-54 {background-color: #FFFF27;}\n",
       ".cython.score-55 {background-color: #FFFF27;}\n",
       ".cython.score-56 {background-color: #FFFF26;}\n",
       ".cython.score-57 {background-color: #FFFF26;}\n",
       ".cython.score-58 {background-color: #FFFF25;}\n",
       ".cython.score-59 {background-color: #FFFF24;}\n",
       ".cython.score-60 {background-color: #FFFF24;}\n",
       ".cython.score-61 {background-color: #FFFF23;}\n",
       ".cython.score-62 {background-color: #FFFF23;}\n",
       ".cython.score-63 {background-color: #FFFF22;}\n",
       ".cython.score-64 {background-color: #FFFF22;}\n",
       ".cython.score-65 {background-color: #FFFF22;}\n",
       ".cython.score-66 {background-color: #FFFF21;}\n",
       ".cython.score-67 {background-color: #FFFF21;}\n",
       ".cython.score-68 {background-color: #FFFF20;}\n",
       ".cython.score-69 {background-color: #FFFF20;}\n",
       ".cython.score-70 {background-color: #FFFF1f;}\n",
       ".cython.score-71 {background-color: #FFFF1f;}\n",
       ".cython.score-72 {background-color: #FFFF1f;}\n",
       ".cython.score-73 {background-color: #FFFF1e;}\n",
       ".cython.score-74 {background-color: #FFFF1e;}\n",
       ".cython.score-75 {background-color: #FFFF1e;}\n",
       ".cython.score-76 {background-color: #FFFF1d;}\n",
       ".cython.score-77 {background-color: #FFFF1d;}\n",
       ".cython.score-78 {background-color: #FFFF1c;}\n",
       ".cython.score-79 {background-color: #FFFF1c;}\n",
       ".cython.score-80 {background-color: #FFFF1c;}\n",
       ".cython.score-81 {background-color: #FFFF1c;}\n",
       ".cython.score-82 {background-color: #FFFF1b;}\n",
       ".cython.score-83 {background-color: #FFFF1b;}\n",
       ".cython.score-84 {background-color: #FFFF1b;}\n",
       ".cython.score-85 {background-color: #FFFF1a;}\n",
       ".cython.score-86 {background-color: #FFFF1a;}\n",
       ".cython.score-87 {background-color: #FFFF1a;}\n",
       ".cython.score-88 {background-color: #FFFF1a;}\n",
       ".cython.score-89 {background-color: #FFFF19;}\n",
       ".cython.score-90 {background-color: #FFFF19;}\n",
       ".cython.score-91 {background-color: #FFFF19;}\n",
       ".cython.score-92 {background-color: #FFFF19;}\n",
       ".cython.score-93 {background-color: #FFFF18;}\n",
       ".cython.score-94 {background-color: #FFFF18;}\n",
       ".cython.score-95 {background-color: #FFFF18;}\n",
       ".cython.score-96 {background-color: #FFFF18;}\n",
       ".cython.score-97 {background-color: #FFFF17;}\n",
       ".cython.score-98 {background-color: #FFFF17;}\n",
       ".cython.score-99 {background-color: #FFFF17;}\n",
       ".cython.score-100 {background-color: #FFFF17;}\n",
       ".cython.score-101 {background-color: #FFFF16;}\n",
       ".cython.score-102 {background-color: #FFFF16;}\n",
       ".cython.score-103 {background-color: #FFFF16;}\n",
       ".cython.score-104 {background-color: #FFFF16;}\n",
       ".cython.score-105 {background-color: #FFFF16;}\n",
       ".cython.score-106 {background-color: #FFFF15;}\n",
       ".cython.score-107 {background-color: #FFFF15;}\n",
       ".cython.score-108 {background-color: #FFFF15;}\n",
       ".cython.score-109 {background-color: #FFFF15;}\n",
       ".cython.score-110 {background-color: #FFFF15;}\n",
       ".cython.score-111 {background-color: #FFFF15;}\n",
       ".cython.score-112 {background-color: #FFFF14;}\n",
       ".cython.score-113 {background-color: #FFFF14;}\n",
       ".cython.score-114 {background-color: #FFFF14;}\n",
       ".cython.score-115 {background-color: #FFFF14;}\n",
       ".cython.score-116 {background-color: #FFFF14;}\n",
       ".cython.score-117 {background-color: #FFFF14;}\n",
       ".cython.score-118 {background-color: #FFFF13;}\n",
       ".cython.score-119 {background-color: #FFFF13;}\n",
       ".cython.score-120 {background-color: #FFFF13;}\n",
       ".cython.score-121 {background-color: #FFFF13;}\n",
       ".cython.score-122 {background-color: #FFFF13;}\n",
       ".cython.score-123 {background-color: #FFFF13;}\n",
       ".cython.score-124 {background-color: #FFFF13;}\n",
       ".cython.score-125 {background-color: #FFFF12;}\n",
       ".cython.score-126 {background-color: #FFFF12;}\n",
       ".cython.score-127 {background-color: #FFFF12;}\n",
       ".cython.score-128 {background-color: #FFFF12;}\n",
       ".cython.score-129 {background-color: #FFFF12;}\n",
       ".cython.score-130 {background-color: #FFFF12;}\n",
       ".cython.score-131 {background-color: #FFFF12;}\n",
       ".cython.score-132 {background-color: #FFFF11;}\n",
       ".cython.score-133 {background-color: #FFFF11;}\n",
       ".cython.score-134 {background-color: #FFFF11;}\n",
       ".cython.score-135 {background-color: #FFFF11;}\n",
       ".cython.score-136 {background-color: #FFFF11;}\n",
       ".cython.score-137 {background-color: #FFFF11;}\n",
       ".cython.score-138 {background-color: #FFFF11;}\n",
       ".cython.score-139 {background-color: #FFFF11;}\n",
       ".cython.score-140 {background-color: #FFFF11;}\n",
       ".cython.score-141 {background-color: #FFFF10;}\n",
       ".cython.score-142 {background-color: #FFFF10;}\n",
       ".cython.score-143 {background-color: #FFFF10;}\n",
       ".cython.score-144 {background-color: #FFFF10;}\n",
       ".cython.score-145 {background-color: #FFFF10;}\n",
       ".cython.score-146 {background-color: #FFFF10;}\n",
       ".cython.score-147 {background-color: #FFFF10;}\n",
       ".cython.score-148 {background-color: #FFFF10;}\n",
       ".cython.score-149 {background-color: #FFFF10;}\n",
       ".cython.score-150 {background-color: #FFFF0f;}\n",
       ".cython.score-151 {background-color: #FFFF0f;}\n",
       ".cython.score-152 {background-color: #FFFF0f;}\n",
       ".cython.score-153 {background-color: #FFFF0f;}\n",
       ".cython.score-154 {background-color: #FFFF0f;}\n",
       ".cython.score-155 {background-color: #FFFF0f;}\n",
       ".cython.score-156 {background-color: #FFFF0f;}\n",
       ".cython.score-157 {background-color: #FFFF0f;}\n",
       ".cython.score-158 {background-color: #FFFF0f;}\n",
       ".cython.score-159 {background-color: #FFFF0f;}\n",
       ".cython.score-160 {background-color: #FFFF0f;}\n",
       ".cython.score-161 {background-color: #FFFF0e;}\n",
       ".cython.score-162 {background-color: #FFFF0e;}\n",
       ".cython.score-163 {background-color: #FFFF0e;}\n",
       ".cython.score-164 {background-color: #FFFF0e;}\n",
       ".cython.score-165 {background-color: #FFFF0e;}\n",
       ".cython.score-166 {background-color: #FFFF0e;}\n",
       ".cython.score-167 {background-color: #FFFF0e;}\n",
       ".cython.score-168 {background-color: #FFFF0e;}\n",
       ".cython.score-169 {background-color: #FFFF0e;}\n",
       ".cython.score-170 {background-color: #FFFF0e;}\n",
       ".cython.score-171 {background-color: #FFFF0e;}\n",
       ".cython.score-172 {background-color: #FFFF0e;}\n",
       ".cython.score-173 {background-color: #FFFF0d;}\n",
       ".cython.score-174 {background-color: #FFFF0d;}\n",
       ".cython.score-175 {background-color: #FFFF0d;}\n",
       ".cython.score-176 {background-color: #FFFF0d;}\n",
       ".cython.score-177 {background-color: #FFFF0d;}\n",
       ".cython.score-178 {background-color: #FFFF0d;}\n",
       ".cython.score-179 {background-color: #FFFF0d;}\n",
       ".cython.score-180 {background-color: #FFFF0d;}\n",
       ".cython.score-181 {background-color: #FFFF0d;}\n",
       ".cython.score-182 {background-color: #FFFF0d;}\n",
       ".cython.score-183 {background-color: #FFFF0d;}\n",
       ".cython.score-184 {background-color: #FFFF0d;}\n",
       ".cython.score-185 {background-color: #FFFF0d;}\n",
       ".cython.score-186 {background-color: #FFFF0d;}\n",
       ".cython.score-187 {background-color: #FFFF0c;}\n",
       ".cython.score-188 {background-color: #FFFF0c;}\n",
       ".cython.score-189 {background-color: #FFFF0c;}\n",
       ".cython.score-190 {background-color: #FFFF0c;}\n",
       ".cython.score-191 {background-color: #FFFF0c;}\n",
       ".cython.score-192 {background-color: #FFFF0c;}\n",
       ".cython.score-193 {background-color: #FFFF0c;}\n",
       ".cython.score-194 {background-color: #FFFF0c;}\n",
       ".cython.score-195 {background-color: #FFFF0c;}\n",
       ".cython.score-196 {background-color: #FFFF0c;}\n",
       ".cython.score-197 {background-color: #FFFF0c;}\n",
       ".cython.score-198 {background-color: #FFFF0c;}\n",
       ".cython.score-199 {background-color: #FFFF0c;}\n",
       ".cython.score-200 {background-color: #FFFF0c;}\n",
       ".cython.score-201 {background-color: #FFFF0c;}\n",
       ".cython.score-202 {background-color: #FFFF0c;}\n",
       ".cython.score-203 {background-color: #FFFF0b;}\n",
       ".cython.score-204 {background-color: #FFFF0b;}\n",
       ".cython.score-205 {background-color: #FFFF0b;}\n",
       ".cython.score-206 {background-color: #FFFF0b;}\n",
       ".cython.score-207 {background-color: #FFFF0b;}\n",
       ".cython.score-208 {background-color: #FFFF0b;}\n",
       ".cython.score-209 {background-color: #FFFF0b;}\n",
       ".cython.score-210 {background-color: #FFFF0b;}\n",
       ".cython.score-211 {background-color: #FFFF0b;}\n",
       ".cython.score-212 {background-color: #FFFF0b;}\n",
       ".cython.score-213 {background-color: #FFFF0b;}\n",
       ".cython.score-214 {background-color: #FFFF0b;}\n",
       ".cython.score-215 {background-color: #FFFF0b;}\n",
       ".cython.score-216 {background-color: #FFFF0b;}\n",
       ".cython.score-217 {background-color: #FFFF0b;}\n",
       ".cython.score-218 {background-color: #FFFF0b;}\n",
       ".cython.score-219 {background-color: #FFFF0b;}\n",
       ".cython.score-220 {background-color: #FFFF0b;}\n",
       ".cython.score-221 {background-color: #FFFF0b;}\n",
       ".cython.score-222 {background-color: #FFFF0a;}\n",
       ".cython.score-223 {background-color: #FFFF0a;}\n",
       ".cython.score-224 {background-color: #FFFF0a;}\n",
       ".cython.score-225 {background-color: #FFFF0a;}\n",
       ".cython.score-226 {background-color: #FFFF0a;}\n",
       ".cython.score-227 {background-color: #FFFF0a;}\n",
       ".cython.score-228 {background-color: #FFFF0a;}\n",
       ".cython.score-229 {background-color: #FFFF0a;}\n",
       ".cython.score-230 {background-color: #FFFF0a;}\n",
       ".cython.score-231 {background-color: #FFFF0a;}\n",
       ".cython.score-232 {background-color: #FFFF0a;}\n",
       ".cython.score-233 {background-color: #FFFF0a;}\n",
       ".cython.score-234 {background-color: #FFFF0a;}\n",
       ".cython.score-235 {background-color: #FFFF0a;}\n",
       ".cython.score-236 {background-color: #FFFF0a;}\n",
       ".cython.score-237 {background-color: #FFFF0a;}\n",
       ".cython.score-238 {background-color: #FFFF0a;}\n",
       ".cython.score-239 {background-color: #FFFF0a;}\n",
       ".cython.score-240 {background-color: #FFFF0a;}\n",
       ".cython.score-241 {background-color: #FFFF0a;}\n",
       ".cython.score-242 {background-color: #FFFF0a;}\n",
       ".cython.score-243 {background-color: #FFFF0a;}\n",
       ".cython.score-244 {background-color: #FFFF0a;}\n",
       ".cython.score-245 {background-color: #FFFF0a;}\n",
       ".cython.score-246 {background-color: #FFFF09;}\n",
       ".cython.score-247 {background-color: #FFFF09;}\n",
       ".cython.score-248 {background-color: #FFFF09;}\n",
       ".cython.score-249 {background-color: #FFFF09;}\n",
       ".cython.score-250 {background-color: #FFFF09;}\n",
       ".cython.score-251 {background-color: #FFFF09;}\n",
       ".cython.score-252 {background-color: #FFFF09;}\n",
       ".cython.score-253 {background-color: #FFFF09;}\n",
       ".cython.score-254 {background-color: #FFFF09;}\n",
       "pre { line-height: 125%; }\n",
       "td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }\n",
       "span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }\n",
       "td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }\n",
       "span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }\n",
       ".cython .hll { background-color: #ffffcc }\n",
       ".cython { background: #f8f8f8; }\n",
       ".cython .c { color: #3D7B7B; font-style: italic } /* Comment */\n",
       ".cython .err { border: 1px solid #FF0000 } /* Error */\n",
       ".cython .k { color: #008000; font-weight: bold } /* Keyword */\n",
       ".cython .o { color: #666666 } /* Operator */\n",
       ".cython .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */\n",
       ".cython .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */\n",
       ".cython .cp { color: #9C6500 } /* Comment.Preproc */\n",
       ".cython .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */\n",
       ".cython .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */\n",
       ".cython .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */\n",
       ".cython .gd { color: #A00000 } /* Generic.Deleted */\n",
       ".cython .ge { font-style: italic } /* Generic.Emph */\n",
       ".cython .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */\n",
       ".cython .gr { color: #E40000 } /* Generic.Error */\n",
       ".cython .gh { color: #000080; font-weight: bold } /* Generic.Heading */\n",
       ".cython .gi { color: #008400 } /* Generic.Inserted */\n",
       ".cython .go { color: #717171 } /* Generic.Output */\n",
       ".cython .gp { color: #000080; font-weight: bold } /* Generic.Prompt */\n",
       ".cython .gs { font-weight: bold } /* Generic.Strong */\n",
       ".cython .gu { color: #800080; font-weight: bold } /* Generic.Subheading */\n",
       ".cython .gt { color: #0044DD } /* Generic.Traceback */\n",
       ".cython .kc { color: #008000; font-weight: bold } /* Keyword.Constant */\n",
       ".cython .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */\n",
       ".cython .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */\n",
       ".cython .kp { color: #008000 } /* Keyword.Pseudo */\n",
       ".cython .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */\n",
       ".cython .kt { color: #B00040 } /* Keyword.Type */\n",
       ".cython .m { color: #666666 } /* Literal.Number */\n",
       ".cython .s { color: #BA2121 } /* Literal.String */\n",
       ".cython .na { color: #687822 } /* Name.Attribute */\n",
       ".cython .nb { color: #008000 } /* Name.Builtin */\n",
       ".cython .nc { color: #0000FF; font-weight: bold } /* Name.Class */\n",
       ".cython .no { color: #880000 } /* Name.Constant */\n",
       ".cython .nd { color: #AA22FF } /* Name.Decorator */\n",
       ".cython .ni { color: #717171; font-weight: bold } /* Name.Entity */\n",
       ".cython .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */\n",
       ".cython .nf { color: #0000FF } /* Name.Function */\n",
       ".cython .nl { color: #767600 } /* Name.Label */\n",
       ".cython .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */\n",
       ".cython .nt { color: #008000; font-weight: bold } /* Name.Tag */\n",
       ".cython .nv { color: #19177C } /* Name.Variable */\n",
       ".cython .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */\n",
       ".cython .w { color: #bbbbbb } /* Text.Whitespace */\n",
       ".cython .mb { color: #666666 } /* Literal.Number.Bin */\n",
       ".cython .mf { color: #666666 } /* Literal.Number.Float */\n",
       ".cython .mh { color: #666666 } /* Literal.Number.Hex */\n",
       ".cython .mi { color: #666666 } /* Literal.Number.Integer */\n",
       ".cython .mo { color: #666666 } /* Literal.Number.Oct */\n",
       ".cython .sa { color: #BA2121 } /* Literal.String.Affix */\n",
       ".cython .sb { color: #BA2121 } /* Literal.String.Backtick */\n",
       ".cython .sc { color: #BA2121 } /* Literal.String.Char */\n",
       ".cython .dl { color: #BA2121 } /* Literal.String.Delimiter */\n",
       ".cython .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */\n",
       ".cython .s2 { color: #BA2121 } /* Literal.String.Double */\n",
       ".cython .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */\n",
       ".cython .sh { color: #BA2121 } /* Literal.String.Heredoc */\n",
       ".cython .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */\n",
       ".cython .sx { color: #008000 } /* Literal.String.Other */\n",
       ".cython .sr { color: #A45A77 } /* Literal.String.Regex */\n",
       ".cython .s1 { color: #BA2121 } /* Literal.String.Single */\n",
       ".cython .ss { color: #19177C } /* Literal.String.Symbol */\n",
       ".cython .bp { color: #008000 } /* Name.Builtin.Pseudo */\n",
       ".cython .fm { color: #0000FF } /* Name.Function.Magic */\n",
       ".cython .vc { color: #19177C } /* Name.Variable.Class */\n",
       ".cython .vg { color: #19177C } /* Name.Variable.Global */\n",
       ".cython .vi { color: #19177C } /* Name.Variable.Instance */\n",
       ".cython .vm { color: #19177C } /* Name.Variable.Magic */\n",
       ".cython .il { color: #666666 } /* Literal.Number.Integer.Long */\n",
       "    </style>\n",
       "</head>\n",
       "<body class=\"cython\">\n",
       "<p><span style=\"border-bottom: solid 1px grey;\">Generated by Cython 3.0.3</span></p>\n",
       "<p>\n",
       "    <span style=\"background-color: #FFFF00\">Yellow lines</span> hint at Python interaction.<br />\n",
       "    Click on a line that starts with a \"<code>+</code>\" to see the C code that Cython generated for it.\n",
       "</p>\n",
       "<div class=\"cython\"><pre class=\"cython line score-16\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">01</span>: <span class=\"k\">import</span> <span class=\"nn\">random</span></pre>\n",
       "<pre class='cython code score-16 '>  __pyx_t_2 = <span class='pyx_c_api'>__Pyx_ImportDottedModule</span>(__pyx_n_s_random, NULL);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n",
       "  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_random, __pyx_t_2) &lt; 0) <span class='error_goto'>__PYX_ERR(0, 1, __pyx_L1_error)</span>\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n",
       "/* … */\n",
       "  __pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyDict_NewPresized</span>(0);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n",
       "  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_test, __pyx_t_2) &lt; 0) <span class='error_goto'>__PYX_ERR(0, 1, __pyx_L1_error)</span>\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n",
       "</pre><pre class=\"cython line score-58\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">02</span>: <span class=\"k\">def</span> <span class=\"nf\">mcs_pi_cy1</span><span class=\"p\">(</span><span class=\"nb\">int</span> <span class=\"n\">n</span><span class=\"p\">):</span></pre>\n",
       "<pre class='cython code score-58 '>/* Python wrapper */\n",
       "static PyObject *__pyx_pw_54_cython_magic_a2c59b961c02fc4401b9f868fa2d9e4bbd64e802_1mcs_pi_cy1(PyObject *__pyx_self, \n",
       "#if CYTHON_METH_FASTCALL\n",
       "PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds\n",
       "#else\n",
       "PyObject *__pyx_args, PyObject *__pyx_kwds\n",
       "#endif\n",
       "); /*proto*/\n",
       "static PyMethodDef __pyx_mdef_54_cython_magic_a2c59b961c02fc4401b9f868fa2d9e4bbd64e802_1mcs_pi_cy1 = {\"mcs_pi_cy1\", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_54_cython_magic_a2c59b961c02fc4401b9f868fa2d9e4bbd64e802_1mcs_pi_cy1, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};\n",
       "static PyObject *__pyx_pw_54_cython_magic_a2c59b961c02fc4401b9f868fa2d9e4bbd64e802_1mcs_pi_cy1(PyObject *__pyx_self, \n",
       "#if CYTHON_METH_FASTCALL\n",
       "PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds\n",
       "#else\n",
       "PyObject *__pyx_args, PyObject *__pyx_kwds\n",
       "#endif\n",
       ") {\n",
       "  int __pyx_v_n;\n",
       "  #if !CYTHON_METH_FASTCALL\n",
       "  CYTHON_UNUSED Py_ssize_t __pyx_nargs;\n",
       "  #endif\n",
       "  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;\n",
       "  PyObject *__pyx_r = 0;\n",
       "  <span class='refnanny'>__Pyx_RefNannyDeclarations</span>\n",
       "  <span class='refnanny'>__Pyx_RefNannySetupContext</span>(\"mcs_pi_cy1 (wrapper)\", 0);\n",
       "  #if !CYTHON_METH_FASTCALL\n",
       "  #if CYTHON_ASSUME_SAFE_MACROS\n",
       "  __pyx_nargs = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args);\n",
       "  #else\n",
       "  __pyx_nargs = <span class='py_c_api'>PyTuple_Size</span>(__pyx_args); if (unlikely(__pyx_nargs &lt; 0)) return NULL;\n",
       "  #endif\n",
       "  #endif\n",
       "  __pyx_kwvalues = <span class='pyx_c_api'>__Pyx_KwValues_FASTCALL</span>(__pyx_args, __pyx_nargs);\n",
       "  {\n",
       "    PyObject **__pyx_pyargnames[] = {&amp;__pyx_n_s_n,0};\n",
       "  PyObject* values[1] = {0};\n",
       "    if (__pyx_kwds) {\n",
       "      Py_ssize_t kw_args;\n",
       "      switch (__pyx_nargs) {\n",
       "        case  1: values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);\n",
       "        CYTHON_FALLTHROUGH;\n",
       "        case  0: break;\n",
       "        default: goto __pyx_L5_argtuple_error;\n",
       "      }\n",
       "      kw_args = <span class='pyx_c_api'>__Pyx_NumKwargs_FASTCALL</span>(__pyx_kwds);\n",
       "      switch (__pyx_nargs) {\n",
       "        case  0:\n",
       "        if (likely((values[0] = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n)) != 0)) {\n",
       "          (void)<span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(values[0]);\n",
       "          kw_args--;\n",
       "        }\n",
       "        else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 2, __pyx_L3_error)</span>\n",
       "        else goto __pyx_L5_argtuple_error;\n",
       "      }\n",
       "      if (unlikely(kw_args &gt; 0)) {\n",
       "        const Py_ssize_t kwd_pos_args = __pyx_nargs;\n",
       "        if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, \"mcs_pi_cy1\") &lt; 0)) <span class='error_goto'>__PYX_ERR(0, 2, __pyx_L3_error)</span>\n",
       "      }\n",
       "    } else if (unlikely(__pyx_nargs != 1)) {\n",
       "      goto __pyx_L5_argtuple_error;\n",
       "    } else {\n",
       "      values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);\n",
       "    }\n",
       "    __pyx_v_n = <span class='pyx_c_api'>__Pyx_PyInt_As_int</span>(values[0]); if (unlikely((__pyx_v_n == (int)-1) &amp;&amp; <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 2, __pyx_L3_error)</span>\n",
       "  }\n",
       "  goto __pyx_L6_skip;\n",
       "  __pyx_L5_argtuple_error:;\n",
       "  <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>(\"mcs_pi_cy1\", 1, 1, 1, __pyx_nargs); <span class='error_goto'>__PYX_ERR(0, 2, __pyx_L3_error)</span>\n",
       "  __pyx_L6_skip:;\n",
       "  goto __pyx_L4_argument_unpacking_done;\n",
       "  __pyx_L3_error:;\n",
       "  {\n",
       "    Py_ssize_t __pyx_temp;\n",
       "    for (__pyx_temp=0; __pyx_temp &lt; (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {\n",
       "      <span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);\n",
       "    }\n",
       "  }\n",
       "  <span class='pyx_c_api'>__Pyx_AddTraceback</span>(\"_cython_magic_a2c59b961c02fc4401b9f868fa2d9e4bbd64e802.mcs_pi_cy1\", __pyx_clineno, __pyx_lineno, __pyx_filename);\n",
       "  <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n",
       "  return NULL;\n",
       "  __pyx_L4_argument_unpacking_done:;\n",
       "  __pyx_r = __pyx_pf_54_cython_magic_a2c59b961c02fc4401b9f868fa2d9e4bbd64e802_mcs_pi_cy1(__pyx_self, __pyx_v_n);\n",
       "  int __pyx_lineno = 0;\n",
       "  const char *__pyx_filename = NULL;\n",
       "  int __pyx_clineno = 0;\n",
       "\n",
       "  /* function exit code */\n",
       "  {\n",
       "    Py_ssize_t __pyx_temp;\n",
       "    for (__pyx_temp=0; __pyx_temp &lt; (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {\n",
       "      <span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);\n",
       "    }\n",
       "  }\n",
       "  <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n",
       "  return __pyx_r;\n",
       "}\n",
       "\n",
       "static PyObject *__pyx_pf_54_cython_magic_a2c59b961c02fc4401b9f868fa2d9e4bbd64e802_mcs_pi_cy1(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_n) {\n",
       "  CYTHON_UNUSED int __pyx_v_i;\n",
       "  int __pyx_v_circle;\n",
       "  float __pyx_v_x;\n",
       "  float __pyx_v_y;\n",
       "  float __pyx_v_z;\n",
       "  PyObject *__pyx_r = NULL;\n",
       "/* … */\n",
       "  /* function exit code */\n",
       "  __pyx_L1_error:;\n",
       "  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4);\n",
       "  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_5);\n",
       "  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_6);\n",
       "  <span class='pyx_c_api'>__Pyx_AddTraceback</span>(\"_cython_magic_a2c59b961c02fc4401b9f868fa2d9e4bbd64e802.mcs_pi_cy1\", __pyx_clineno, __pyx_lineno, __pyx_filename);\n",
       "  __pyx_r = NULL;\n",
       "  __pyx_L0:;\n",
       "  <span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);\n",
       "  <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n",
       "  return __pyx_r;\n",
       "}\n",
       "/* … */\n",
       "  __pyx_tuple__2 = <span class='py_c_api'>PyTuple_Pack</span>(6, __pyx_n_s_n, __pyx_n_s_i, __pyx_n_s_circle, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z);<span class='error_goto'> if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 2, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_tuple__2);\n",
       "  <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_tuple__2);\n",
       "/* … */\n",
       "  __pyx_t_2 = <span class='pyx_c_api'>__Pyx_CyFunction_New</span>(&amp;__pyx_mdef_54_cython_magic_a2c59b961c02fc4401b9f868fa2d9e4bbd64e802_1mcs_pi_cy1, 0, __pyx_n_s_mcs_pi_cy1, NULL, __pyx_n_s_cython_magic_a2c59b961c02fc4401, __pyx_d, ((PyObject *)__pyx_codeobj__3));<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n",
       "  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_mcs_pi_cy1, __pyx_t_2) &lt; 0) <span class='error_goto'>__PYX_ERR(0, 2, __pyx_L1_error)</span>\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">03</span>:     <span class=\"k\">cdef</span> <span class=\"kt\">int</span> <span class=\"nf\">i</span><span class=\"p\">,</span> <span class=\"nf\">circle</span> <span class=\"o\">=</span> <span class=\"mf\">0</span></pre>\n",
       "<pre class='cython code score-0 '>  __pyx_v_circle = 0;\n",
       "</pre><pre class=\"cython line score-0\">&#xA0;<span class=\"\">04</span>:     <span class=\"k\">cdef</span> <span class=\"kt\">float</span> <span class=\"nf\">x</span><span class=\"p\">,</span> <span class=\"nf\">y</span><span class=\"p\">,</span> <span class=\"nf\">z</span></pre>\n",
       "<pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">05</span>:     <span class=\"k\">for</span> <span class=\"n\">i</span> <span class=\"ow\">in</span> <span class=\"nb\">range</span><span class=\"p\">(</span><span class=\"n\">n</span><span class=\"p\">):</span></pre>\n",
       "<pre class='cython code score-0 '>  __pyx_t_1 = __pyx_v_n;\n",
       "  __pyx_t_2 = __pyx_t_1;\n",
       "  for (__pyx_t_3 = 0; __pyx_t_3 &lt; __pyx_t_2; __pyx_t_3+=1) {\n",
       "    __pyx_v_i = __pyx_t_3;\n",
       "</pre><pre class=\"cython line score-60\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">06</span>:         <span class=\"n\">x</span><span class=\"p\">,</span> <span class=\"n\">y</span> <span class=\"o\">=</span> <span class=\"n\">random</span><span class=\"o\">.</span><span class=\"n\">random</span><span class=\"p\">(),</span> <span class=\"n\">random</span><span class=\"o\">.</span><span class=\"n\">random</span><span class=\"p\">()</span></pre>\n",
       "<pre class='cython code score-60 '>    <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_5, __pyx_n_s_random);<span class='error_goto'> if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 6, __pyx_L1_error)</span>\n",
       "    <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_5);\n",
       "    __pyx_t_6 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_5, __pyx_n_s_random);<span class='error_goto'> if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 6, __pyx_L1_error)</span>\n",
       "    <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n",
       "    <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0;\n",
       "    __pyx_t_5 = NULL;\n",
       "    __pyx_t_7 = 0;\n",
       "    #if CYTHON_UNPACK_METHODS\n",
       "    if (unlikely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_6))) {\n",
       "      __pyx_t_5 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_6);\n",
       "      if (likely(__pyx_t_5)) {\n",
       "        PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_6);\n",
       "        <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_5);\n",
       "        <span class='pyx_macro_api'>__Pyx_INCREF</span>(function);\n",
       "        <span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_6, function);\n",
       "        __pyx_t_7 = 1;\n",
       "      }\n",
       "    }\n",
       "    #endif\n",
       "    {\n",
       "      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};\n",
       "      __pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);\n",
       "      <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_5); __pyx_t_5 = 0;\n",
       "      if (unlikely(!__pyx_t_4)) <span class='error_goto'>__PYX_ERR(0, 6, __pyx_L1_error)</span>\n",
       "      <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n",
       "      <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n",
       "    }\n",
       "    __pyx_t_8 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_t_4); if (unlikely((__pyx_t_8 == (float)-1) &amp;&amp; <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 6, __pyx_L1_error)</span>\n",
       "    <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n",
       "    <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_6, __pyx_n_s_random);<span class='error_goto'> if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 6, __pyx_L1_error)</span>\n",
       "    <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n",
       "    __pyx_t_5 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_6, __pyx_n_s_random);<span class='error_goto'> if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 6, __pyx_L1_error)</span>\n",
       "    <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_5);\n",
       "    <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n",
       "    __pyx_t_6 = NULL;\n",
       "    __pyx_t_7 = 0;\n",
       "    #if CYTHON_UNPACK_METHODS\n",
       "    if (unlikely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_5))) {\n",
       "      __pyx_t_6 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_5);\n",
       "      if (likely(__pyx_t_6)) {\n",
       "        PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_5);\n",
       "        <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_6);\n",
       "        <span class='pyx_macro_api'>__Pyx_INCREF</span>(function);\n",
       "        <span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_5, function);\n",
       "        __pyx_t_7 = 1;\n",
       "      }\n",
       "    }\n",
       "    #endif\n",
       "    {\n",
       "      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};\n",
       "      __pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);\n",
       "      <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n",
       "      if (unlikely(!__pyx_t_4)) <span class='error_goto'>__PYX_ERR(0, 6, __pyx_L1_error)</span>\n",
       "      <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n",
       "      <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0;\n",
       "    }\n",
       "    __pyx_t_9 = __pyx_<span class='py_c_api'>PyFloat_AsFloat</span>(__pyx_t_4); if (unlikely((__pyx_t_9 == (float)-1) &amp;&amp; <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 6, __pyx_L1_error)</span>\n",
       "    <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n",
       "    __pyx_v_x = __pyx_t_8;\n",
       "    __pyx_v_y = __pyx_t_9;\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">07</span>:         <span class=\"n\">z</span> <span class=\"o\">=</span> <span class=\"p\">(</span><span class=\"n\">x</span> <span class=\"o\">**</span> <span class=\"mf\">2</span> <span class=\"o\">+</span> <span class=\"n\">y</span> <span class=\"o\">**</span> <span class=\"mf\">2</span><span class=\"p\">)</span> <span class=\"o\">**</span> <span class=\"mf\">0.5</span></pre>\n",
       "<pre class='cython code score-0 '>    __pyx_v_z = pow(((double)(powf(__pyx_v_x, 2.0) + powf(__pyx_v_y, 2.0))), 0.5);\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">08</span>:         <span class=\"k\">if</span> <span class=\"n\">z</span> <span class=\"o\">&lt;=</span> <span class=\"mf\">1</span><span class=\"p\">:</span></pre>\n",
       "<pre class='cython code score-0 '>    __pyx_t_10 = (__pyx_v_z &lt;= 1.0);\n",
       "    if (__pyx_t_10) {\n",
       "/* … */\n",
       "    }\n",
       "  }\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">09</span>:             <span class=\"n\">circle</span> <span class=\"o\">+=</span> <span class=\"mf\">1</span></pre>\n",
       "<pre class='cython code score-0 '>      __pyx_v_circle = (__pyx_v_circle + 1);\n",
       "</pre><pre class=\"cython line score-11\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">10</span>:     <span class=\"k\">return</span> <span class=\"p\">(</span><span class=\"mf\">4</span> <span class=\"o\">*</span> <span class=\"n\">circle</span><span class=\"p\">)</span> <span class=\"o\">/</span> <span class=\"n\">n</span></pre>\n",
       "<pre class='cython code score-11 '>  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);\n",
       "  __pyx_t_11 = (4 * __pyx_v_circle);\n",
       "  if (unlikely(__pyx_v_n == 0)) {\n",
       "    <span class='py_c_api'>PyErr_SetString</span>(PyExc_ZeroDivisionError, \"float division\");\n",
       "    <span class='error_goto'>__PYX_ERR(0, 10, __pyx_L1_error)</span>\n",
       "  }\n",
       "  __pyx_t_4 = <span class='py_c_api'>PyFloat_FromDouble</span>((((double)__pyx_t_11) / ((double)__pyx_v_n)));<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 10, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n",
       "  __pyx_r = __pyx_t_4;\n",
       "  __pyx_t_4 = 0;\n",
       "  goto __pyx_L0;\n",
       "</pre></div></body></html>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "execution_count": 94,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%%cython -a\n",
    "import random\n",
    "def mcs_pi_cy1(int n):\n",
    "    cdef int i, circle = 0\n",
    "    cdef float x, y, z\n",
    "    for i in range(n):\n",
    "        x, y = random.random(), random.random()\n",
    "        z = (x ** 2 + y ** 2) ** 0.5\n",
    "        if z <= 1:\n",
    "            circle += 1\n",
    "    return (4 * circle) / n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 518 ms, sys: 4.33 ms, total: 522 ms\n",
      "Wall time: 522 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "3.141308"
      ]
     },
     "execution_count": 95,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time mcs_pi_cy1(n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<!-- Generated by Cython 3.0.3 -->\n",
       "<html>\n",
       "<head>\n",
       "    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n",
       "    <title>Cython: _cython_magic_d28b3e600775e7f59f9f9c5e47d96f51eb40778c.pyx</title>\n",
       "    <style type=\"text/css\">\n",
       "    \n",
       "body.cython { font-family: courier; font-size: 12; }\n",
       "\n",
       ".cython.tag  {  }\n",
       ".cython.line { color: #000000; margin: 0em }\n",
       ".cython.code { font-size: 9; color: #444444; display: none; margin: 0px 0px 0px 8px; border-left: 8px none; }\n",
       "\n",
       ".cython.line .run { background-color: #B0FFB0; }\n",
       ".cython.line .mis { background-color: #FFB0B0; }\n",
       ".cython.code.run  { border-left: 8px solid #B0FFB0; }\n",
       ".cython.code.mis  { border-left: 8px solid #FFB0B0; }\n",
       "\n",
       ".cython.code .py_c_api  { color: red; }\n",
       ".cython.code .py_macro_api  { color: #FF7000; }\n",
       ".cython.code .pyx_c_api  { color: #FF3000; }\n",
       ".cython.code .pyx_macro_api  { color: #FF7000; }\n",
       ".cython.code .refnanny  { color: #FFA000; }\n",
       ".cython.code .trace  { color: #FFA000; }\n",
       ".cython.code .error_goto  { color: #FFA000; }\n",
       "\n",
       ".cython.code .coerce  { color: #008000; border: 1px dotted #008000 }\n",
       ".cython.code .py_attr { color: #FF0000; font-weight: bold; }\n",
       ".cython.code .c_attr  { color: #0000FF; }\n",
       ".cython.code .py_call { color: #FF0000; font-weight: bold; }\n",
       ".cython.code .c_call  { color: #0000FF; }\n",
       "\n",
       ".cython.score-0 {background-color: #FFFFff;}\n",
       ".cython.score-1 {background-color: #FFFFe7;}\n",
       ".cython.score-2 {background-color: #FFFFd4;}\n",
       ".cython.score-3 {background-color: #FFFFc4;}\n",
       ".cython.score-4 {background-color: #FFFFb6;}\n",
       ".cython.score-5 {background-color: #FFFFaa;}\n",
       ".cython.score-6 {background-color: #FFFF9f;}\n",
       ".cython.score-7 {background-color: #FFFF96;}\n",
       ".cython.score-8 {background-color: #FFFF8d;}\n",
       ".cython.score-9 {background-color: #FFFF86;}\n",
       ".cython.score-10 {background-color: #FFFF7f;}\n",
       ".cython.score-11 {background-color: #FFFF79;}\n",
       ".cython.score-12 {background-color: #FFFF73;}\n",
       ".cython.score-13 {background-color: #FFFF6e;}\n",
       ".cython.score-14 {background-color: #FFFF6a;}\n",
       ".cython.score-15 {background-color: #FFFF66;}\n",
       ".cython.score-16 {background-color: #FFFF62;}\n",
       ".cython.score-17 {background-color: #FFFF5e;}\n",
       ".cython.score-18 {background-color: #FFFF5b;}\n",
       ".cython.score-19 {background-color: #FFFF57;}\n",
       ".cython.score-20 {background-color: #FFFF55;}\n",
       ".cython.score-21 {background-color: #FFFF52;}\n",
       ".cython.score-22 {background-color: #FFFF4f;}\n",
       ".cython.score-23 {background-color: #FFFF4d;}\n",
       ".cython.score-24 {background-color: #FFFF4b;}\n",
       ".cython.score-25 {background-color: #FFFF48;}\n",
       ".cython.score-26 {background-color: #FFFF46;}\n",
       ".cython.score-27 {background-color: #FFFF44;}\n",
       ".cython.score-28 {background-color: #FFFF43;}\n",
       ".cython.score-29 {background-color: #FFFF41;}\n",
       ".cython.score-30 {background-color: #FFFF3f;}\n",
       ".cython.score-31 {background-color: #FFFF3e;}\n",
       ".cython.score-32 {background-color: #FFFF3c;}\n",
       ".cython.score-33 {background-color: #FFFF3b;}\n",
       ".cython.score-34 {background-color: #FFFF39;}\n",
       ".cython.score-35 {background-color: #FFFF38;}\n",
       ".cython.score-36 {background-color: #FFFF37;}\n",
       ".cython.score-37 {background-color: #FFFF36;}\n",
       ".cython.score-38 {background-color: #FFFF35;}\n",
       ".cython.score-39 {background-color: #FFFF34;}\n",
       ".cython.score-40 {background-color: #FFFF33;}\n",
       ".cython.score-41 {background-color: #FFFF32;}\n",
       ".cython.score-42 {background-color: #FFFF31;}\n",
       ".cython.score-43 {background-color: #FFFF30;}\n",
       ".cython.score-44 {background-color: #FFFF2f;}\n",
       ".cython.score-45 {background-color: #FFFF2e;}\n",
       ".cython.score-46 {background-color: #FFFF2d;}\n",
       ".cython.score-47 {background-color: #FFFF2c;}\n",
       ".cython.score-48 {background-color: #FFFF2b;}\n",
       ".cython.score-49 {background-color: #FFFF2b;}\n",
       ".cython.score-50 {background-color: #FFFF2a;}\n",
       ".cython.score-51 {background-color: #FFFF29;}\n",
       ".cython.score-52 {background-color: #FFFF29;}\n",
       ".cython.score-53 {background-color: #FFFF28;}\n",
       ".cython.score-54 {background-color: #FFFF27;}\n",
       ".cython.score-55 {background-color: #FFFF27;}\n",
       ".cython.score-56 {background-color: #FFFF26;}\n",
       ".cython.score-57 {background-color: #FFFF26;}\n",
       ".cython.score-58 {background-color: #FFFF25;}\n",
       ".cython.score-59 {background-color: #FFFF24;}\n",
       ".cython.score-60 {background-color: #FFFF24;}\n",
       ".cython.score-61 {background-color: #FFFF23;}\n",
       ".cython.score-62 {background-color: #FFFF23;}\n",
       ".cython.score-63 {background-color: #FFFF22;}\n",
       ".cython.score-64 {background-color: #FFFF22;}\n",
       ".cython.score-65 {background-color: #FFFF22;}\n",
       ".cython.score-66 {background-color: #FFFF21;}\n",
       ".cython.score-67 {background-color: #FFFF21;}\n",
       ".cython.score-68 {background-color: #FFFF20;}\n",
       ".cython.score-69 {background-color: #FFFF20;}\n",
       ".cython.score-70 {background-color: #FFFF1f;}\n",
       ".cython.score-71 {background-color: #FFFF1f;}\n",
       ".cython.score-72 {background-color: #FFFF1f;}\n",
       ".cython.score-73 {background-color: #FFFF1e;}\n",
       ".cython.score-74 {background-color: #FFFF1e;}\n",
       ".cython.score-75 {background-color: #FFFF1e;}\n",
       ".cython.score-76 {background-color: #FFFF1d;}\n",
       ".cython.score-77 {background-color: #FFFF1d;}\n",
       ".cython.score-78 {background-color: #FFFF1c;}\n",
       ".cython.score-79 {background-color: #FFFF1c;}\n",
       ".cython.score-80 {background-color: #FFFF1c;}\n",
       ".cython.score-81 {background-color: #FFFF1c;}\n",
       ".cython.score-82 {background-color: #FFFF1b;}\n",
       ".cython.score-83 {background-color: #FFFF1b;}\n",
       ".cython.score-84 {background-color: #FFFF1b;}\n",
       ".cython.score-85 {background-color: #FFFF1a;}\n",
       ".cython.score-86 {background-color: #FFFF1a;}\n",
       ".cython.score-87 {background-color: #FFFF1a;}\n",
       ".cython.score-88 {background-color: #FFFF1a;}\n",
       ".cython.score-89 {background-color: #FFFF19;}\n",
       ".cython.score-90 {background-color: #FFFF19;}\n",
       ".cython.score-91 {background-color: #FFFF19;}\n",
       ".cython.score-92 {background-color: #FFFF19;}\n",
       ".cython.score-93 {background-color: #FFFF18;}\n",
       ".cython.score-94 {background-color: #FFFF18;}\n",
       ".cython.score-95 {background-color: #FFFF18;}\n",
       ".cython.score-96 {background-color: #FFFF18;}\n",
       ".cython.score-97 {background-color: #FFFF17;}\n",
       ".cython.score-98 {background-color: #FFFF17;}\n",
       ".cython.score-99 {background-color: #FFFF17;}\n",
       ".cython.score-100 {background-color: #FFFF17;}\n",
       ".cython.score-101 {background-color: #FFFF16;}\n",
       ".cython.score-102 {background-color: #FFFF16;}\n",
       ".cython.score-103 {background-color: #FFFF16;}\n",
       ".cython.score-104 {background-color: #FFFF16;}\n",
       ".cython.score-105 {background-color: #FFFF16;}\n",
       ".cython.score-106 {background-color: #FFFF15;}\n",
       ".cython.score-107 {background-color: #FFFF15;}\n",
       ".cython.score-108 {background-color: #FFFF15;}\n",
       ".cython.score-109 {background-color: #FFFF15;}\n",
       ".cython.score-110 {background-color: #FFFF15;}\n",
       ".cython.score-111 {background-color: #FFFF15;}\n",
       ".cython.score-112 {background-color: #FFFF14;}\n",
       ".cython.score-113 {background-color: #FFFF14;}\n",
       ".cython.score-114 {background-color: #FFFF14;}\n",
       ".cython.score-115 {background-color: #FFFF14;}\n",
       ".cython.score-116 {background-color: #FFFF14;}\n",
       ".cython.score-117 {background-color: #FFFF14;}\n",
       ".cython.score-118 {background-color: #FFFF13;}\n",
       ".cython.score-119 {background-color: #FFFF13;}\n",
       ".cython.score-120 {background-color: #FFFF13;}\n",
       ".cython.score-121 {background-color: #FFFF13;}\n",
       ".cython.score-122 {background-color: #FFFF13;}\n",
       ".cython.score-123 {background-color: #FFFF13;}\n",
       ".cython.score-124 {background-color: #FFFF13;}\n",
       ".cython.score-125 {background-color: #FFFF12;}\n",
       ".cython.score-126 {background-color: #FFFF12;}\n",
       ".cython.score-127 {background-color: #FFFF12;}\n",
       ".cython.score-128 {background-color: #FFFF12;}\n",
       ".cython.score-129 {background-color: #FFFF12;}\n",
       ".cython.score-130 {background-color: #FFFF12;}\n",
       ".cython.score-131 {background-color: #FFFF12;}\n",
       ".cython.score-132 {background-color: #FFFF11;}\n",
       ".cython.score-133 {background-color: #FFFF11;}\n",
       ".cython.score-134 {background-color: #FFFF11;}\n",
       ".cython.score-135 {background-color: #FFFF11;}\n",
       ".cython.score-136 {background-color: #FFFF11;}\n",
       ".cython.score-137 {background-color: #FFFF11;}\n",
       ".cython.score-138 {background-color: #FFFF11;}\n",
       ".cython.score-139 {background-color: #FFFF11;}\n",
       ".cython.score-140 {background-color: #FFFF11;}\n",
       ".cython.score-141 {background-color: #FFFF10;}\n",
       ".cython.score-142 {background-color: #FFFF10;}\n",
       ".cython.score-143 {background-color: #FFFF10;}\n",
       ".cython.score-144 {background-color: #FFFF10;}\n",
       ".cython.score-145 {background-color: #FFFF10;}\n",
       ".cython.score-146 {background-color: #FFFF10;}\n",
       ".cython.score-147 {background-color: #FFFF10;}\n",
       ".cython.score-148 {background-color: #FFFF10;}\n",
       ".cython.score-149 {background-color: #FFFF10;}\n",
       ".cython.score-150 {background-color: #FFFF0f;}\n",
       ".cython.score-151 {background-color: #FFFF0f;}\n",
       ".cython.score-152 {background-color: #FFFF0f;}\n",
       ".cython.score-153 {background-color: #FFFF0f;}\n",
       ".cython.score-154 {background-color: #FFFF0f;}\n",
       ".cython.score-155 {background-color: #FFFF0f;}\n",
       ".cython.score-156 {background-color: #FFFF0f;}\n",
       ".cython.score-157 {background-color: #FFFF0f;}\n",
       ".cython.score-158 {background-color: #FFFF0f;}\n",
       ".cython.score-159 {background-color: #FFFF0f;}\n",
       ".cython.score-160 {background-color: #FFFF0f;}\n",
       ".cython.score-161 {background-color: #FFFF0e;}\n",
       ".cython.score-162 {background-color: #FFFF0e;}\n",
       ".cython.score-163 {background-color: #FFFF0e;}\n",
       ".cython.score-164 {background-color: #FFFF0e;}\n",
       ".cython.score-165 {background-color: #FFFF0e;}\n",
       ".cython.score-166 {background-color: #FFFF0e;}\n",
       ".cython.score-167 {background-color: #FFFF0e;}\n",
       ".cython.score-168 {background-color: #FFFF0e;}\n",
       ".cython.score-169 {background-color: #FFFF0e;}\n",
       ".cython.score-170 {background-color: #FFFF0e;}\n",
       ".cython.score-171 {background-color: #FFFF0e;}\n",
       ".cython.score-172 {background-color: #FFFF0e;}\n",
       ".cython.score-173 {background-color: #FFFF0d;}\n",
       ".cython.score-174 {background-color: #FFFF0d;}\n",
       ".cython.score-175 {background-color: #FFFF0d;}\n",
       ".cython.score-176 {background-color: #FFFF0d;}\n",
       ".cython.score-177 {background-color: #FFFF0d;}\n",
       ".cython.score-178 {background-color: #FFFF0d;}\n",
       ".cython.score-179 {background-color: #FFFF0d;}\n",
       ".cython.score-180 {background-color: #FFFF0d;}\n",
       ".cython.score-181 {background-color: #FFFF0d;}\n",
       ".cython.score-182 {background-color: #FFFF0d;}\n",
       ".cython.score-183 {background-color: #FFFF0d;}\n",
       ".cython.score-184 {background-color: #FFFF0d;}\n",
       ".cython.score-185 {background-color: #FFFF0d;}\n",
       ".cython.score-186 {background-color: #FFFF0d;}\n",
       ".cython.score-187 {background-color: #FFFF0c;}\n",
       ".cython.score-188 {background-color: #FFFF0c;}\n",
       ".cython.score-189 {background-color: #FFFF0c;}\n",
       ".cython.score-190 {background-color: #FFFF0c;}\n",
       ".cython.score-191 {background-color: #FFFF0c;}\n",
       ".cython.score-192 {background-color: #FFFF0c;}\n",
       ".cython.score-193 {background-color: #FFFF0c;}\n",
       ".cython.score-194 {background-color: #FFFF0c;}\n",
       ".cython.score-195 {background-color: #FFFF0c;}\n",
       ".cython.score-196 {background-color: #FFFF0c;}\n",
       ".cython.score-197 {background-color: #FFFF0c;}\n",
       ".cython.score-198 {background-color: #FFFF0c;}\n",
       ".cython.score-199 {background-color: #FFFF0c;}\n",
       ".cython.score-200 {background-color: #FFFF0c;}\n",
       ".cython.score-201 {background-color: #FFFF0c;}\n",
       ".cython.score-202 {background-color: #FFFF0c;}\n",
       ".cython.score-203 {background-color: #FFFF0b;}\n",
       ".cython.score-204 {background-color: #FFFF0b;}\n",
       ".cython.score-205 {background-color: #FFFF0b;}\n",
       ".cython.score-206 {background-color: #FFFF0b;}\n",
       ".cython.score-207 {background-color: #FFFF0b;}\n",
       ".cython.score-208 {background-color: #FFFF0b;}\n",
       ".cython.score-209 {background-color: #FFFF0b;}\n",
       ".cython.score-210 {background-color: #FFFF0b;}\n",
       ".cython.score-211 {background-color: #FFFF0b;}\n",
       ".cython.score-212 {background-color: #FFFF0b;}\n",
       ".cython.score-213 {background-color: #FFFF0b;}\n",
       ".cython.score-214 {background-color: #FFFF0b;}\n",
       ".cython.score-215 {background-color: #FFFF0b;}\n",
       ".cython.score-216 {background-color: #FFFF0b;}\n",
       ".cython.score-217 {background-color: #FFFF0b;}\n",
       ".cython.score-218 {background-color: #FFFF0b;}\n",
       ".cython.score-219 {background-color: #FFFF0b;}\n",
       ".cython.score-220 {background-color: #FFFF0b;}\n",
       ".cython.score-221 {background-color: #FFFF0b;}\n",
       ".cython.score-222 {background-color: #FFFF0a;}\n",
       ".cython.score-223 {background-color: #FFFF0a;}\n",
       ".cython.score-224 {background-color: #FFFF0a;}\n",
       ".cython.score-225 {background-color: #FFFF0a;}\n",
       ".cython.score-226 {background-color: #FFFF0a;}\n",
       ".cython.score-227 {background-color: #FFFF0a;}\n",
       ".cython.score-228 {background-color: #FFFF0a;}\n",
       ".cython.score-229 {background-color: #FFFF0a;}\n",
       ".cython.score-230 {background-color: #FFFF0a;}\n",
       ".cython.score-231 {background-color: #FFFF0a;}\n",
       ".cython.score-232 {background-color: #FFFF0a;}\n",
       ".cython.score-233 {background-color: #FFFF0a;}\n",
       ".cython.score-234 {background-color: #FFFF0a;}\n",
       ".cython.score-235 {background-color: #FFFF0a;}\n",
       ".cython.score-236 {background-color: #FFFF0a;}\n",
       ".cython.score-237 {background-color: #FFFF0a;}\n",
       ".cython.score-238 {background-color: #FFFF0a;}\n",
       ".cython.score-239 {background-color: #FFFF0a;}\n",
       ".cython.score-240 {background-color: #FFFF0a;}\n",
       ".cython.score-241 {background-color: #FFFF0a;}\n",
       ".cython.score-242 {background-color: #FFFF0a;}\n",
       ".cython.score-243 {background-color: #FFFF0a;}\n",
       ".cython.score-244 {background-color: #FFFF0a;}\n",
       ".cython.score-245 {background-color: #FFFF0a;}\n",
       ".cython.score-246 {background-color: #FFFF09;}\n",
       ".cython.score-247 {background-color: #FFFF09;}\n",
       ".cython.score-248 {background-color: #FFFF09;}\n",
       ".cython.score-249 {background-color: #FFFF09;}\n",
       ".cython.score-250 {background-color: #FFFF09;}\n",
       ".cython.score-251 {background-color: #FFFF09;}\n",
       ".cython.score-252 {background-color: #FFFF09;}\n",
       ".cython.score-253 {background-color: #FFFF09;}\n",
       ".cython.score-254 {background-color: #FFFF09;}\n",
       "pre { line-height: 125%; }\n",
       "td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }\n",
       "span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }\n",
       "td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }\n",
       "span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }\n",
       ".cython .hll { background-color: #ffffcc }\n",
       ".cython { background: #f8f8f8; }\n",
       ".cython .c { color: #3D7B7B; font-style: italic } /* Comment */\n",
       ".cython .err { border: 1px solid #FF0000 } /* Error */\n",
       ".cython .k { color: #008000; font-weight: bold } /* Keyword */\n",
       ".cython .o { color: #666666 } /* Operator */\n",
       ".cython .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */\n",
       ".cython .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */\n",
       ".cython .cp { color: #9C6500 } /* Comment.Preproc */\n",
       ".cython .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */\n",
       ".cython .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */\n",
       ".cython .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */\n",
       ".cython .gd { color: #A00000 } /* Generic.Deleted */\n",
       ".cython .ge { font-style: italic } /* Generic.Emph */\n",
       ".cython .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */\n",
       ".cython .gr { color: #E40000 } /* Generic.Error */\n",
       ".cython .gh { color: #000080; font-weight: bold } /* Generic.Heading */\n",
       ".cython .gi { color: #008400 } /* Generic.Inserted */\n",
       ".cython .go { color: #717171 } /* Generic.Output */\n",
       ".cython .gp { color: #000080; font-weight: bold } /* Generic.Prompt */\n",
       ".cython .gs { font-weight: bold } /* Generic.Strong */\n",
       ".cython .gu { color: #800080; font-weight: bold } /* Generic.Subheading */\n",
       ".cython .gt { color: #0044DD } /* Generic.Traceback */\n",
       ".cython .kc { color: #008000; font-weight: bold } /* Keyword.Constant */\n",
       ".cython .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */\n",
       ".cython .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */\n",
       ".cython .kp { color: #008000 } /* Keyword.Pseudo */\n",
       ".cython .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */\n",
       ".cython .kt { color: #B00040 } /* Keyword.Type */\n",
       ".cython .m { color: #666666 } /* Literal.Number */\n",
       ".cython .s { color: #BA2121 } /* Literal.String */\n",
       ".cython .na { color: #687822 } /* Name.Attribute */\n",
       ".cython .nb { color: #008000 } /* Name.Builtin */\n",
       ".cython .nc { color: #0000FF; font-weight: bold } /* Name.Class */\n",
       ".cython .no { color: #880000 } /* Name.Constant */\n",
       ".cython .nd { color: #AA22FF } /* Name.Decorator */\n",
       ".cython .ni { color: #717171; font-weight: bold } /* Name.Entity */\n",
       ".cython .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */\n",
       ".cython .nf { color: #0000FF } /* Name.Function */\n",
       ".cython .nl { color: #767600 } /* Name.Label */\n",
       ".cython .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */\n",
       ".cython .nt { color: #008000; font-weight: bold } /* Name.Tag */\n",
       ".cython .nv { color: #19177C } /* Name.Variable */\n",
       ".cython .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */\n",
       ".cython .w { color: #bbbbbb } /* Text.Whitespace */\n",
       ".cython .mb { color: #666666 } /* Literal.Number.Bin */\n",
       ".cython .mf { color: #666666 } /* Literal.Number.Float */\n",
       ".cython .mh { color: #666666 } /* Literal.Number.Hex */\n",
       ".cython .mi { color: #666666 } /* Literal.Number.Integer */\n",
       ".cython .mo { color: #666666 } /* Literal.Number.Oct */\n",
       ".cython .sa { color: #BA2121 } /* Literal.String.Affix */\n",
       ".cython .sb { color: #BA2121 } /* Literal.String.Backtick */\n",
       ".cython .sc { color: #BA2121 } /* Literal.String.Char */\n",
       ".cython .dl { color: #BA2121 } /* Literal.String.Delimiter */\n",
       ".cython .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */\n",
       ".cython .s2 { color: #BA2121 } /* Literal.String.Double */\n",
       ".cython .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */\n",
       ".cython .sh { color: #BA2121 } /* Literal.String.Heredoc */\n",
       ".cython .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */\n",
       ".cython .sx { color: #008000 } /* Literal.String.Other */\n",
       ".cython .sr { color: #A45A77 } /* Literal.String.Regex */\n",
       ".cython .s1 { color: #BA2121 } /* Literal.String.Single */\n",
       ".cython .ss { color: #19177C } /* Literal.String.Symbol */\n",
       ".cython .bp { color: #008000 } /* Name.Builtin.Pseudo */\n",
       ".cython .fm { color: #0000FF } /* Name.Function.Magic */\n",
       ".cython .vc { color: #19177C } /* Name.Variable.Class */\n",
       ".cython .vg { color: #19177C } /* Name.Variable.Global */\n",
       ".cython .vi { color: #19177C } /* Name.Variable.Instance */\n",
       ".cython .vm { color: #19177C } /* Name.Variable.Magic */\n",
       ".cython .il { color: #666666 } /* Literal.Number.Integer.Long */\n",
       "    </style>\n",
       "</head>\n",
       "<body class=\"cython\">\n",
       "<p><span style=\"border-bottom: solid 1px grey;\">Generated by Cython 3.0.3</span></p>\n",
       "<p>\n",
       "    <span style=\"background-color: #FFFF00\">Yellow lines</span> hint at Python interaction.<br />\n",
       "    Click on a line that starts with a \"<code>+</code>\" to see the C code that Cython generated for it.\n",
       "</p>\n",
       "<div class=\"cython\"><pre class=\"cython line score-8\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">01</span>: <span class=\"k\">from</span> <span class=\"nn\">libc.stdlib</span> <span class=\"k\">cimport</span> <span class=\"n\">rand</span></pre>\n",
       "<pre class='cython code score-8 '>  __pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyDict_NewPresized</span>(0);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n",
       "  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_test, __pyx_t_2) &lt; 0) <span class='error_goto'>__PYX_ERR(0, 1, __pyx_L1_error)</span>\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n",
       "</pre><pre class=\"cython line score-0\">&#xA0;<span class=\"\">02</span>: <span class=\"k\">cdef</span> <span class=\"kr\">extern</span> <span class=\"k\">from</span> <span class=\"s\">&#39;limits.h&#39;</span><span class=\"p\">:</span></pre>\n",
       "<pre class=\"cython line score-0\">&#xA0;<span class=\"\">03</span>:     <span class=\"nb\">int</span> <span class=\"n\">INT_MAX</span></pre>\n",
       "<pre class=\"cython line score-56\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">04</span>: <span class=\"k\">def</span> <span class=\"nf\">mcs_pi_cy2</span><span class=\"p\">(</span><span class=\"nb\">int</span> <span class=\"n\">n</span><span class=\"p\">):</span></pre>\n",
       "<pre class='cython code score-56 '>/* Python wrapper */\n",
       "static PyObject *__pyx_pw_54_cython_magic_d28b3e600775e7f59f9f9c5e47d96f51eb40778c_1mcs_pi_cy2(PyObject *__pyx_self, \n",
       "#if CYTHON_METH_FASTCALL\n",
       "PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds\n",
       "#else\n",
       "PyObject *__pyx_args, PyObject *__pyx_kwds\n",
       "#endif\n",
       "); /*proto*/\n",
       "static PyMethodDef __pyx_mdef_54_cython_magic_d28b3e600775e7f59f9f9c5e47d96f51eb40778c_1mcs_pi_cy2 = {\"mcs_pi_cy2\", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_54_cython_magic_d28b3e600775e7f59f9f9c5e47d96f51eb40778c_1mcs_pi_cy2, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};\n",
       "static PyObject *__pyx_pw_54_cython_magic_d28b3e600775e7f59f9f9c5e47d96f51eb40778c_1mcs_pi_cy2(PyObject *__pyx_self, \n",
       "#if CYTHON_METH_FASTCALL\n",
       "PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds\n",
       "#else\n",
       "PyObject *__pyx_args, PyObject *__pyx_kwds\n",
       "#endif\n",
       ") {\n",
       "  int __pyx_v_n;\n",
       "  #if !CYTHON_METH_FASTCALL\n",
       "  CYTHON_UNUSED Py_ssize_t __pyx_nargs;\n",
       "  #endif\n",
       "  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;\n",
       "  PyObject *__pyx_r = 0;\n",
       "  <span class='refnanny'>__Pyx_RefNannyDeclarations</span>\n",
       "  <span class='refnanny'>__Pyx_RefNannySetupContext</span>(\"mcs_pi_cy2 (wrapper)\", 0);\n",
       "  #if !CYTHON_METH_FASTCALL\n",
       "  #if CYTHON_ASSUME_SAFE_MACROS\n",
       "  __pyx_nargs = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args);\n",
       "  #else\n",
       "  __pyx_nargs = <span class='py_c_api'>PyTuple_Size</span>(__pyx_args); if (unlikely(__pyx_nargs &lt; 0)) return NULL;\n",
       "  #endif\n",
       "  #endif\n",
       "  __pyx_kwvalues = <span class='pyx_c_api'>__Pyx_KwValues_FASTCALL</span>(__pyx_args, __pyx_nargs);\n",
       "  {\n",
       "    PyObject **__pyx_pyargnames[] = {&amp;__pyx_n_s_n,0};\n",
       "  PyObject* values[1] = {0};\n",
       "    if (__pyx_kwds) {\n",
       "      Py_ssize_t kw_args;\n",
       "      switch (__pyx_nargs) {\n",
       "        case  1: values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);\n",
       "        CYTHON_FALLTHROUGH;\n",
       "        case  0: break;\n",
       "        default: goto __pyx_L5_argtuple_error;\n",
       "      }\n",
       "      kw_args = <span class='pyx_c_api'>__Pyx_NumKwargs_FASTCALL</span>(__pyx_kwds);\n",
       "      switch (__pyx_nargs) {\n",
       "        case  0:\n",
       "        if (likely((values[0] = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n)) != 0)) {\n",
       "          (void)<span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(values[0]);\n",
       "          kw_args--;\n",
       "        }\n",
       "        else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 4, __pyx_L3_error)</span>\n",
       "        else goto __pyx_L5_argtuple_error;\n",
       "      }\n",
       "      if (unlikely(kw_args &gt; 0)) {\n",
       "        const Py_ssize_t kwd_pos_args = __pyx_nargs;\n",
       "        if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, \"mcs_pi_cy2\") &lt; 0)) <span class='error_goto'>__PYX_ERR(0, 4, __pyx_L3_error)</span>\n",
       "      }\n",
       "    } else if (unlikely(__pyx_nargs != 1)) {\n",
       "      goto __pyx_L5_argtuple_error;\n",
       "    } else {\n",
       "      values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);\n",
       "    }\n",
       "    __pyx_v_n = <span class='pyx_c_api'>__Pyx_PyInt_As_int</span>(values[0]); if (unlikely((__pyx_v_n == (int)-1) &amp;&amp; <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 4, __pyx_L3_error)</span>\n",
       "  }\n",
       "  goto __pyx_L6_skip;\n",
       "  __pyx_L5_argtuple_error:;\n",
       "  <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>(\"mcs_pi_cy2\", 1, 1, 1, __pyx_nargs); <span class='error_goto'>__PYX_ERR(0, 4, __pyx_L3_error)</span>\n",
       "  __pyx_L6_skip:;\n",
       "  goto __pyx_L4_argument_unpacking_done;\n",
       "  __pyx_L3_error:;\n",
       "  {\n",
       "    Py_ssize_t __pyx_temp;\n",
       "    for (__pyx_temp=0; __pyx_temp &lt; (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {\n",
       "      <span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);\n",
       "    }\n",
       "  }\n",
       "  <span class='pyx_c_api'>__Pyx_AddTraceback</span>(\"_cython_magic_d28b3e600775e7f59f9f9c5e47d96f51eb40778c.mcs_pi_cy2\", __pyx_clineno, __pyx_lineno, __pyx_filename);\n",
       "  <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n",
       "  return NULL;\n",
       "  __pyx_L4_argument_unpacking_done:;\n",
       "  __pyx_r = __pyx_pf_54_cython_magic_d28b3e600775e7f59f9f9c5e47d96f51eb40778c_mcs_pi_cy2(__pyx_self, __pyx_v_n);\n",
       "  int __pyx_lineno = 0;\n",
       "  const char *__pyx_filename = NULL;\n",
       "  int __pyx_clineno = 0;\n",
       "\n",
       "  /* function exit code */\n",
       "  {\n",
       "    Py_ssize_t __pyx_temp;\n",
       "    for (__pyx_temp=0; __pyx_temp &lt; (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {\n",
       "      <span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);\n",
       "    }\n",
       "  }\n",
       "  <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n",
       "  return __pyx_r;\n",
       "}\n",
       "\n",
       "static PyObject *__pyx_pf_54_cython_magic_d28b3e600775e7f59f9f9c5e47d96f51eb40778c_mcs_pi_cy2(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_n) {\n",
       "  CYTHON_UNUSED int __pyx_v_i;\n",
       "  int __pyx_v_circle;\n",
       "  float __pyx_v_x;\n",
       "  float __pyx_v_y;\n",
       "  float __pyx_v_z;\n",
       "  PyObject *__pyx_r = NULL;\n",
       "/* … */\n",
       "  /* function exit code */\n",
       "  __pyx_L1_error:;\n",
       "  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_9);\n",
       "  <span class='pyx_c_api'>__Pyx_AddTraceback</span>(\"_cython_magic_d28b3e600775e7f59f9f9c5e47d96f51eb40778c.mcs_pi_cy2\", __pyx_clineno, __pyx_lineno, __pyx_filename);\n",
       "  __pyx_r = NULL;\n",
       "  __pyx_L0:;\n",
       "  <span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);\n",
       "  <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n",
       "  return __pyx_r;\n",
       "}\n",
       "/* … */\n",
       "  __pyx_tuple_ = <span class='py_c_api'>PyTuple_Pack</span>(6, __pyx_n_s_n, __pyx_n_s_i, __pyx_n_s_circle, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z);<span class='error_goto'> if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 4, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_tuple_);\n",
       "  <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_tuple_);\n",
       "/* … */\n",
       "  __pyx_t_2 = <span class='pyx_c_api'>__Pyx_CyFunction_New</span>(&amp;__pyx_mdef_54_cython_magic_d28b3e600775e7f59f9f9c5e47d96f51eb40778c_1mcs_pi_cy2, 0, __pyx_n_s_mcs_pi_cy2, NULL, __pyx_n_s_cython_magic_d28b3e600775e7f59f, __pyx_d, ((PyObject *)__pyx_codeobj__2));<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n",
       "  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_mcs_pi_cy2, __pyx_t_2) &lt; 0) <span class='error_goto'>__PYX_ERR(0, 4, __pyx_L1_error)</span>\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">05</span>:     <span class=\"k\">cdef</span> <span class=\"kt\">int</span> <span class=\"nf\">i</span><span class=\"p\">,</span> <span class=\"nf\">circle</span> <span class=\"o\">=</span> <span class=\"mf\">0</span></pre>\n",
       "<pre class='cython code score-0 '>  __pyx_v_circle = 0;\n",
       "</pre><pre class=\"cython line score-0\">&#xA0;<span class=\"\">06</span>:     <span class=\"k\">cdef</span> <span class=\"kt\">float</span> <span class=\"nf\">x</span><span class=\"p\">,</span> <span class=\"nf\">y</span><span class=\"p\">,</span> <span class=\"nf\">z</span></pre>\n",
       "<pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">07</span>:     <span class=\"k\">for</span> <span class=\"n\">i</span> <span class=\"ow\">in</span> <span class=\"nb\">range</span><span class=\"p\">(</span><span class=\"n\">n</span><span class=\"p\">):</span></pre>\n",
       "<pre class='cython code score-0 '>  __pyx_t_1 = __pyx_v_n;\n",
       "  __pyx_t_2 = __pyx_t_1;\n",
       "  for (__pyx_t_3 = 0; __pyx_t_3 &lt; __pyx_t_2; __pyx_t_3+=1) {\n",
       "    __pyx_v_i = __pyx_t_3;\n",
       "</pre><pre class=\"cython line score-10\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">08</span>:         <span class=\"n\">x</span><span class=\"p\">,</span> <span class=\"n\">y</span> <span class=\"o\">=</span> <span class=\"n\">rand</span><span class=\"p\">()</span> <span class=\"o\">/</span> <span class=\"n\">INT_MAX</span><span class=\"p\">,</span> <span class=\"n\">rand</span><span class=\"p\">()</span> <span class=\"o\">/</span> <span class=\"n\">INT_MAX</span></pre>\n",
       "<pre class='cython code score-10 '>    __pyx_t_4 = rand();\n",
       "    if (unlikely(INT_MAX == 0)) {\n",
       "      <span class='py_c_api'>PyErr_SetString</span>(PyExc_ZeroDivisionError, \"float division\");\n",
       "      <span class='error_goto'>__PYX_ERR(0, 8, __pyx_L1_error)</span>\n",
       "    }\n",
       "    __pyx_t_5 = (((double)__pyx_t_4) / ((double)INT_MAX));\n",
       "    __pyx_t_4 = rand();\n",
       "    if (unlikely(INT_MAX == 0)) {\n",
       "      <span class='py_c_api'>PyErr_SetString</span>(PyExc_ZeroDivisionError, \"float division\");\n",
       "      <span class='error_goto'>__PYX_ERR(0, 8, __pyx_L1_error)</span>\n",
       "    }\n",
       "    __pyx_t_6 = (((double)__pyx_t_4) / ((double)INT_MAX));\n",
       "    __pyx_v_x = __pyx_t_5;\n",
       "    __pyx_v_y = __pyx_t_6;\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">09</span>:         <span class=\"n\">z</span> <span class=\"o\">=</span> <span class=\"p\">(</span><span class=\"n\">x</span> <span class=\"o\">**</span> <span class=\"mf\">2</span> <span class=\"o\">+</span> <span class=\"n\">y</span> <span class=\"o\">**</span> <span class=\"mf\">2</span><span class=\"p\">)</span> <span class=\"o\">**</span> <span class=\"mf\">0.5</span></pre>\n",
       "<pre class='cython code score-0 '>    __pyx_v_z = pow(((double)(powf(__pyx_v_x, 2.0) + powf(__pyx_v_y, 2.0))), 0.5);\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">10</span>:         <span class=\"k\">if</span> <span class=\"n\">z</span> <span class=\"o\">&lt;=</span> <span class=\"mf\">1</span><span class=\"p\">:</span></pre>\n",
       "<pre class='cython code score-0 '>    __pyx_t_7 = (__pyx_v_z &lt;= 1.0);\n",
       "    if (__pyx_t_7) {\n",
       "/* … */\n",
       "    }\n",
       "  }\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">11</span>:             <span class=\"n\">circle</span> <span class=\"o\">+=</span> <span class=\"mf\">1</span></pre>\n",
       "<pre class='cython code score-0 '>      __pyx_v_circle = (__pyx_v_circle + 1);\n",
       "</pre><pre class=\"cython line score-11\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">12</span>:     <span class=\"k\">return</span> <span class=\"p\">(</span><span class=\"mf\">4</span> <span class=\"o\">*</span> <span class=\"n\">circle</span><span class=\"p\">)</span> <span class=\"o\">/</span> <span class=\"n\">n</span></pre>\n",
       "<pre class='cython code score-11 '>  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);\n",
       "  __pyx_t_8 = (4 * __pyx_v_circle);\n",
       "  if (unlikely(__pyx_v_n == 0)) {\n",
       "    <span class='py_c_api'>PyErr_SetString</span>(PyExc_ZeroDivisionError, \"float division\");\n",
       "    <span class='error_goto'>__PYX_ERR(0, 12, __pyx_L1_error)</span>\n",
       "  }\n",
       "  __pyx_t_9 = <span class='py_c_api'>PyFloat_FromDouble</span>((((double)__pyx_t_8) / ((double)__pyx_v_n)));<span class='error_goto'> if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 12, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);\n",
       "  __pyx_r = __pyx_t_9;\n",
       "  __pyx_t_9 = 0;\n",
       "  goto __pyx_L0;\n",
       "</pre></div></body></html>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "execution_count": 96,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%%cython -a\n",
    "from libc.stdlib cimport rand\n",
    "cdef extern from 'limits.h':\n",
    "    int INT_MAX\n",
    "def mcs_pi_cy2(int n):\n",
    "    cdef int i, circle = 0\n",
    "    cdef float x, y, z\n",
    "    for i in range(n):\n",
    "        x, y = rand() / INT_MAX, rand() / INT_MAX\n",
    "        z = (x ** 2 + y ** 2) ** 0.5\n",
    "        if z <= 1:\n",
    "            circle += 1\n",
    "    return (4 * circle) / n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 141 ms, sys: 482 µs, total: 142 ms\n",
      "Wall time: 141 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "3.1419388"
      ]
     },
     "execution_count": 97,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time mcs_pi_cy2(n)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Binomial Trees"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Python"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {},
   "outputs": [],
   "source": [
    "import math"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {},
   "outputs": [],
   "source": [
    "S0 = 36.  \n",
    "T = 1.0  \n",
    "r = 0.06  \n",
    "sigma = 0.2  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {},
   "outputs": [],
   "source": [
    "def simulate_tree(M):\n",
    "    dt = T / M  \n",
    "    u = math.exp(sigma * math.sqrt(dt))  \n",
    "    d = 1 / u  \n",
    "    S = np.zeros((M + 1, M + 1))\n",
    "    S[0, 0] = S0\n",
    "    z = 1\n",
    "    for t in range(1, M + 1):\n",
    "        for i in range(z):\n",
    "            S[i, t] = S[i, t-1] * u\n",
    "            S[i+1, t] = S[i, t-1] * d\n",
    "        z += 1\n",
    "    return S"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "metadata": {},
   "outputs": [],
   "source": [
    "np.set_printoptions(formatter={'float':\n",
    "                               lambda x: '%6.2f' % x})  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 36.00,  39.79,  43.97,  48.59,  53.71],\n",
       "       [  0.00,  32.57,  36.00,  39.79,  43.97],\n",
       "       [  0.00,   0.00,  29.47,  32.57,  36.00],\n",
       "       [  0.00,   0.00,   0.00,  26.67,  29.47],\n",
       "       [  0.00,   0.00,   0.00,   0.00,  24.13]])"
      ]
     },
     "execution_count": 102,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simulate_tree(4)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 45.1 ms, sys: 2.09 ms, total: 47.2 ms\n",
      "Wall time: 62.2 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([[ 36.00,  36.32,  36.65, ..., 3095.69, 3123.50, 3151.57],\n",
       "       [  0.00,  35.68,  36.00, ..., 3040.81, 3068.13, 3095.69],\n",
       "       [  0.00,   0.00,  35.36, ..., 2986.89, 3013.73, 3040.81],\n",
       "       ...,\n",
       "       [  0.00,   0.00,   0.00, ...,   0.42,   0.42,   0.43],\n",
       "       [  0.00,   0.00,   0.00, ...,   0.00,   0.41,   0.42],\n",
       "       [  0.00,   0.00,   0.00, ...,   0.00,   0.00,   0.41]])"
      ]
     },
     "execution_count": 103,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time simulate_tree(500)  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### NumPy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "metadata": {},
   "outputs": [],
   "source": [
    "M = 4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0, 1, 2, 3, 4],\n",
       "       [0, 1, 2, 3, 4],\n",
       "       [0, 1, 2, 3, 4],\n",
       "       [0, 1, 2, 3, 4],\n",
       "       [0, 1, 2, 3, 4]])"
      ]
     },
     "execution_count": 105,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "up = np.arange(M + 1)\n",
    "up = np.resize(up, (M + 1, M + 1))  \n",
    "up"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0, 0, 0, 0, 0],\n",
       "       [2, 2, 2, 2, 2],\n",
       "       [4, 4, 4, 4, 4],\n",
       "       [6, 6, 6, 6, 6],\n",
       "       [8, 8, 8, 8, 8]])"
      ]
     },
     "execution_count": 106,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "down = up.T * 2  \n",
    "down"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3,  4],\n",
       "       [-2, -1,  0,  1,  2],\n",
       "       [-4, -3, -2, -1,  0],\n",
       "       [-6, -5, -4, -3, -2],\n",
       "       [-8, -7, -6, -5, -4]])"
      ]
     },
     "execution_count": 107,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "up - down  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "metadata": {},
   "outputs": [],
   "source": [
    "dt = T / M"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 36.00,  39.79,  43.97,  48.59,  53.71],\n",
       "       [ 29.47,  32.57,  36.00,  39.79,  43.97],\n",
       "       [ 24.13,  26.67,  29.47,  32.57,  36.00],\n",
       "       [ 19.76,  21.84,  24.13,  26.67,  29.47],\n",
       "       [ 16.18,  17.88,  19.76,  21.84,  24.13]])"
      ]
     },
     "execution_count": 109,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "S0 * np.exp(sigma * math.sqrt(dt) * (up - down))  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "metadata": {},
   "outputs": [],
   "source": [
    "def simulate_tree_np(M):\n",
    "    dt = T / M\n",
    "    up = np.arange(M + 1)\n",
    "    up = np.resize(up, (M + 1, M + 1))\n",
    "    down = up.transpose() * 2\n",
    "    S = S0 * np.exp(sigma * math.sqrt(dt) * (up - down))\n",
    "    return S"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 36.00,  39.79,  43.97,  48.59,  53.71],\n",
       "       [ 29.47,  32.57,  36.00,  39.79,  43.97],\n",
       "       [ 24.13,  26.67,  29.47,  32.57,  36.00],\n",
       "       [ 19.76,  21.84,  24.13,  26.67,  29.47],\n",
       "       [ 16.18,  17.88,  19.76,  21.84,  24.13]])"
      ]
     },
     "execution_count": 111,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simulate_tree_np(4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 1.99 ms, sys: 1.77 ms, total: 3.76 ms\n",
      "Wall time: 4.19 ms\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([[ 36.00,  36.32,  36.65, ..., 3095.69, 3123.50, 3151.57],\n",
       "       [ 35.36,  35.68,  36.00, ..., 3040.81, 3068.13, 3095.69],\n",
       "       [ 34.73,  35.05,  35.36, ..., 2986.89, 3013.73, 3040.81],\n",
       "       ...,\n",
       "       [  0.00,   0.00,   0.00, ...,   0.42,   0.42,   0.43],\n",
       "       [  0.00,   0.00,   0.00, ...,   0.41,   0.41,   0.42],\n",
       "       [  0.00,   0.00,   0.00, ...,   0.40,   0.41,   0.41]])"
      ]
     },
     "execution_count": 112,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time simulate_tree_np(500)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Numba"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "metadata": {},
   "outputs": [],
   "source": [
    "simulate_tree_nb = numba.jit(simulate_tree)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 36.00,  39.79,  43.97,  48.59,  53.71],\n",
       "       [  0.00,  32.57,  36.00,  39.79,  43.97],\n",
       "       [  0.00,   0.00,  29.47,  32.57,  36.00],\n",
       "       [  0.00,   0.00,   0.00,  26.67,  29.47],\n",
       "       [  0.00,   0.00,   0.00,   0.00,  24.13]])"
      ]
     },
     "execution_count": 114,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simulate_tree_nb(4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 115,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 100 µs, sys: 156 µs, total: 256 µs\n",
      "Wall time: 257 µs\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([[ 36.00,  36.32,  36.65, ..., 3095.69, 3123.50, 3151.57],\n",
       "       [  0.00,  35.68,  36.00, ..., 3040.81, 3068.13, 3095.69],\n",
       "       [  0.00,   0.00,  35.36, ..., 2986.89, 3013.73, 3040.81],\n",
       "       ...,\n",
       "       [  0.00,   0.00,   0.00, ...,   0.42,   0.42,   0.43],\n",
       "       [  0.00,   0.00,   0.00, ...,   0.00,   0.41,   0.42],\n",
       "       [  0.00,   0.00,   0.00, ...,   0.00,   0.00,   0.41]])"
      ]
     },
     "execution_count": 115,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time simulate_tree_nb(500)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "94.6 µs ± 22.1 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n"
     ]
    }
   ],
   "source": [
    "%timeit simulate_tree_nb(500)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Cython"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<!-- Generated by Cython 3.0.3 -->\n",
       "<html>\n",
       "<head>\n",
       "    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n",
       "    <title>Cython: _cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69.pyx</title>\n",
       "    <style type=\"text/css\">\n",
       "    \n",
       "body.cython { font-family: courier; font-size: 12; }\n",
       "\n",
       ".cython.tag  {  }\n",
       ".cython.line { color: #000000; margin: 0em }\n",
       ".cython.code { font-size: 9; color: #444444; display: none; margin: 0px 0px 0px 8px; border-left: 8px none; }\n",
       "\n",
       ".cython.line .run { background-color: #B0FFB0; }\n",
       ".cython.line .mis { background-color: #FFB0B0; }\n",
       ".cython.code.run  { border-left: 8px solid #B0FFB0; }\n",
       ".cython.code.mis  { border-left: 8px solid #FFB0B0; }\n",
       "\n",
       ".cython.code .py_c_api  { color: red; }\n",
       ".cython.code .py_macro_api  { color: #FF7000; }\n",
       ".cython.code .pyx_c_api  { color: #FF3000; }\n",
       ".cython.code .pyx_macro_api  { color: #FF7000; }\n",
       ".cython.code .refnanny  { color: #FFA000; }\n",
       ".cython.code .trace  { color: #FFA000; }\n",
       ".cython.code .error_goto  { color: #FFA000; }\n",
       "\n",
       ".cython.code .coerce  { color: #008000; border: 1px dotted #008000 }\n",
       ".cython.code .py_attr { color: #FF0000; font-weight: bold; }\n",
       ".cython.code .c_attr  { color: #0000FF; }\n",
       ".cython.code .py_call { color: #FF0000; font-weight: bold; }\n",
       ".cython.code .c_call  { color: #0000FF; }\n",
       "\n",
       ".cython.score-0 {background-color: #FFFFff;}\n",
       ".cython.score-1 {background-color: #FFFFe7;}\n",
       ".cython.score-2 {background-color: #FFFFd4;}\n",
       ".cython.score-3 {background-color: #FFFFc4;}\n",
       ".cython.score-4 {background-color: #FFFFb6;}\n",
       ".cython.score-5 {background-color: #FFFFaa;}\n",
       ".cython.score-6 {background-color: #FFFF9f;}\n",
       ".cython.score-7 {background-color: #FFFF96;}\n",
       ".cython.score-8 {background-color: #FFFF8d;}\n",
       ".cython.score-9 {background-color: #FFFF86;}\n",
       ".cython.score-10 {background-color: #FFFF7f;}\n",
       ".cython.score-11 {background-color: #FFFF79;}\n",
       ".cython.score-12 {background-color: #FFFF73;}\n",
       ".cython.score-13 {background-color: #FFFF6e;}\n",
       ".cython.score-14 {background-color: #FFFF6a;}\n",
       ".cython.score-15 {background-color: #FFFF66;}\n",
       ".cython.score-16 {background-color: #FFFF62;}\n",
       ".cython.score-17 {background-color: #FFFF5e;}\n",
       ".cython.score-18 {background-color: #FFFF5b;}\n",
       ".cython.score-19 {background-color: #FFFF57;}\n",
       ".cython.score-20 {background-color: #FFFF55;}\n",
       ".cython.score-21 {background-color: #FFFF52;}\n",
       ".cython.score-22 {background-color: #FFFF4f;}\n",
       ".cython.score-23 {background-color: #FFFF4d;}\n",
       ".cython.score-24 {background-color: #FFFF4b;}\n",
       ".cython.score-25 {background-color: #FFFF48;}\n",
       ".cython.score-26 {background-color: #FFFF46;}\n",
       ".cython.score-27 {background-color: #FFFF44;}\n",
       ".cython.score-28 {background-color: #FFFF43;}\n",
       ".cython.score-29 {background-color: #FFFF41;}\n",
       ".cython.score-30 {background-color: #FFFF3f;}\n",
       ".cython.score-31 {background-color: #FFFF3e;}\n",
       ".cython.score-32 {background-color: #FFFF3c;}\n",
       ".cython.score-33 {background-color: #FFFF3b;}\n",
       ".cython.score-34 {background-color: #FFFF39;}\n",
       ".cython.score-35 {background-color: #FFFF38;}\n",
       ".cython.score-36 {background-color: #FFFF37;}\n",
       ".cython.score-37 {background-color: #FFFF36;}\n",
       ".cython.score-38 {background-color: #FFFF35;}\n",
       ".cython.score-39 {background-color: #FFFF34;}\n",
       ".cython.score-40 {background-color: #FFFF33;}\n",
       ".cython.score-41 {background-color: #FFFF32;}\n",
       ".cython.score-42 {background-color: #FFFF31;}\n",
       ".cython.score-43 {background-color: #FFFF30;}\n",
       ".cython.score-44 {background-color: #FFFF2f;}\n",
       ".cython.score-45 {background-color: #FFFF2e;}\n",
       ".cython.score-46 {background-color: #FFFF2d;}\n",
       ".cython.score-47 {background-color: #FFFF2c;}\n",
       ".cython.score-48 {background-color: #FFFF2b;}\n",
       ".cython.score-49 {background-color: #FFFF2b;}\n",
       ".cython.score-50 {background-color: #FFFF2a;}\n",
       ".cython.score-51 {background-color: #FFFF29;}\n",
       ".cython.score-52 {background-color: #FFFF29;}\n",
       ".cython.score-53 {background-color: #FFFF28;}\n",
       ".cython.score-54 {background-color: #FFFF27;}\n",
       ".cython.score-55 {background-color: #FFFF27;}\n",
       ".cython.score-56 {background-color: #FFFF26;}\n",
       ".cython.score-57 {background-color: #FFFF26;}\n",
       ".cython.score-58 {background-color: #FFFF25;}\n",
       ".cython.score-59 {background-color: #FFFF24;}\n",
       ".cython.score-60 {background-color: #FFFF24;}\n",
       ".cython.score-61 {background-color: #FFFF23;}\n",
       ".cython.score-62 {background-color: #FFFF23;}\n",
       ".cython.score-63 {background-color: #FFFF22;}\n",
       ".cython.score-64 {background-color: #FFFF22;}\n",
       ".cython.score-65 {background-color: #FFFF22;}\n",
       ".cython.score-66 {background-color: #FFFF21;}\n",
       ".cython.score-67 {background-color: #FFFF21;}\n",
       ".cython.score-68 {background-color: #FFFF20;}\n",
       ".cython.score-69 {background-color: #FFFF20;}\n",
       ".cython.score-70 {background-color: #FFFF1f;}\n",
       ".cython.score-71 {background-color: #FFFF1f;}\n",
       ".cython.score-72 {background-color: #FFFF1f;}\n",
       ".cython.score-73 {background-color: #FFFF1e;}\n",
       ".cython.score-74 {background-color: #FFFF1e;}\n",
       ".cython.score-75 {background-color: #FFFF1e;}\n",
       ".cython.score-76 {background-color: #FFFF1d;}\n",
       ".cython.score-77 {background-color: #FFFF1d;}\n",
       ".cython.score-78 {background-color: #FFFF1c;}\n",
       ".cython.score-79 {background-color: #FFFF1c;}\n",
       ".cython.score-80 {background-color: #FFFF1c;}\n",
       ".cython.score-81 {background-color: #FFFF1c;}\n",
       ".cython.score-82 {background-color: #FFFF1b;}\n",
       ".cython.score-83 {background-color: #FFFF1b;}\n",
       ".cython.score-84 {background-color: #FFFF1b;}\n",
       ".cython.score-85 {background-color: #FFFF1a;}\n",
       ".cython.score-86 {background-color: #FFFF1a;}\n",
       ".cython.score-87 {background-color: #FFFF1a;}\n",
       ".cython.score-88 {background-color: #FFFF1a;}\n",
       ".cython.score-89 {background-color: #FFFF19;}\n",
       ".cython.score-90 {background-color: #FFFF19;}\n",
       ".cython.score-91 {background-color: #FFFF19;}\n",
       ".cython.score-92 {background-color: #FFFF19;}\n",
       ".cython.score-93 {background-color: #FFFF18;}\n",
       ".cython.score-94 {background-color: #FFFF18;}\n",
       ".cython.score-95 {background-color: #FFFF18;}\n",
       ".cython.score-96 {background-color: #FFFF18;}\n",
       ".cython.score-97 {background-color: #FFFF17;}\n",
       ".cython.score-98 {background-color: #FFFF17;}\n",
       ".cython.score-99 {background-color: #FFFF17;}\n",
       ".cython.score-100 {background-color: #FFFF17;}\n",
       ".cython.score-101 {background-color: #FFFF16;}\n",
       ".cython.score-102 {background-color: #FFFF16;}\n",
       ".cython.score-103 {background-color: #FFFF16;}\n",
       ".cython.score-104 {background-color: #FFFF16;}\n",
       ".cython.score-105 {background-color: #FFFF16;}\n",
       ".cython.score-106 {background-color: #FFFF15;}\n",
       ".cython.score-107 {background-color: #FFFF15;}\n",
       ".cython.score-108 {background-color: #FFFF15;}\n",
       ".cython.score-109 {background-color: #FFFF15;}\n",
       ".cython.score-110 {background-color: #FFFF15;}\n",
       ".cython.score-111 {background-color: #FFFF15;}\n",
       ".cython.score-112 {background-color: #FFFF14;}\n",
       ".cython.score-113 {background-color: #FFFF14;}\n",
       ".cython.score-114 {background-color: #FFFF14;}\n",
       ".cython.score-115 {background-color: #FFFF14;}\n",
       ".cython.score-116 {background-color: #FFFF14;}\n",
       ".cython.score-117 {background-color: #FFFF14;}\n",
       ".cython.score-118 {background-color: #FFFF13;}\n",
       ".cython.score-119 {background-color: #FFFF13;}\n",
       ".cython.score-120 {background-color: #FFFF13;}\n",
       ".cython.score-121 {background-color: #FFFF13;}\n",
       ".cython.score-122 {background-color: #FFFF13;}\n",
       ".cython.score-123 {background-color: #FFFF13;}\n",
       ".cython.score-124 {background-color: #FFFF13;}\n",
       ".cython.score-125 {background-color: #FFFF12;}\n",
       ".cython.score-126 {background-color: #FFFF12;}\n",
       ".cython.score-127 {background-color: #FFFF12;}\n",
       ".cython.score-128 {background-color: #FFFF12;}\n",
       ".cython.score-129 {background-color: #FFFF12;}\n",
       ".cython.score-130 {background-color: #FFFF12;}\n",
       ".cython.score-131 {background-color: #FFFF12;}\n",
       ".cython.score-132 {background-color: #FFFF11;}\n",
       ".cython.score-133 {background-color: #FFFF11;}\n",
       ".cython.score-134 {background-color: #FFFF11;}\n",
       ".cython.score-135 {background-color: #FFFF11;}\n",
       ".cython.score-136 {background-color: #FFFF11;}\n",
       ".cython.score-137 {background-color: #FFFF11;}\n",
       ".cython.score-138 {background-color: #FFFF11;}\n",
       ".cython.score-139 {background-color: #FFFF11;}\n",
       ".cython.score-140 {background-color: #FFFF11;}\n",
       ".cython.score-141 {background-color: #FFFF10;}\n",
       ".cython.score-142 {background-color: #FFFF10;}\n",
       ".cython.score-143 {background-color: #FFFF10;}\n",
       ".cython.score-144 {background-color: #FFFF10;}\n",
       ".cython.score-145 {background-color: #FFFF10;}\n",
       ".cython.score-146 {background-color: #FFFF10;}\n",
       ".cython.score-147 {background-color: #FFFF10;}\n",
       ".cython.score-148 {background-color: #FFFF10;}\n",
       ".cython.score-149 {background-color: #FFFF10;}\n",
       ".cython.score-150 {background-color: #FFFF0f;}\n",
       ".cython.score-151 {background-color: #FFFF0f;}\n",
       ".cython.score-152 {background-color: #FFFF0f;}\n",
       ".cython.score-153 {background-color: #FFFF0f;}\n",
       ".cython.score-154 {background-color: #FFFF0f;}\n",
       ".cython.score-155 {background-color: #FFFF0f;}\n",
       ".cython.score-156 {background-color: #FFFF0f;}\n",
       ".cython.score-157 {background-color: #FFFF0f;}\n",
       ".cython.score-158 {background-color: #FFFF0f;}\n",
       ".cython.score-159 {background-color: #FFFF0f;}\n",
       ".cython.score-160 {background-color: #FFFF0f;}\n",
       ".cython.score-161 {background-color: #FFFF0e;}\n",
       ".cython.score-162 {background-color: #FFFF0e;}\n",
       ".cython.score-163 {background-color: #FFFF0e;}\n",
       ".cython.score-164 {background-color: #FFFF0e;}\n",
       ".cython.score-165 {background-color: #FFFF0e;}\n",
       ".cython.score-166 {background-color: #FFFF0e;}\n",
       ".cython.score-167 {background-color: #FFFF0e;}\n",
       ".cython.score-168 {background-color: #FFFF0e;}\n",
       ".cython.score-169 {background-color: #FFFF0e;}\n",
       ".cython.score-170 {background-color: #FFFF0e;}\n",
       ".cython.score-171 {background-color: #FFFF0e;}\n",
       ".cython.score-172 {background-color: #FFFF0e;}\n",
       ".cython.score-173 {background-color: #FFFF0d;}\n",
       ".cython.score-174 {background-color: #FFFF0d;}\n",
       ".cython.score-175 {background-color: #FFFF0d;}\n",
       ".cython.score-176 {background-color: #FFFF0d;}\n",
       ".cython.score-177 {background-color: #FFFF0d;}\n",
       ".cython.score-178 {background-color: #FFFF0d;}\n",
       ".cython.score-179 {background-color: #FFFF0d;}\n",
       ".cython.score-180 {background-color: #FFFF0d;}\n",
       ".cython.score-181 {background-color: #FFFF0d;}\n",
       ".cython.score-182 {background-color: #FFFF0d;}\n",
       ".cython.score-183 {background-color: #FFFF0d;}\n",
       ".cython.score-184 {background-color: #FFFF0d;}\n",
       ".cython.score-185 {background-color: #FFFF0d;}\n",
       ".cython.score-186 {background-color: #FFFF0d;}\n",
       ".cython.score-187 {background-color: #FFFF0c;}\n",
       ".cython.score-188 {background-color: #FFFF0c;}\n",
       ".cython.score-189 {background-color: #FFFF0c;}\n",
       ".cython.score-190 {background-color: #FFFF0c;}\n",
       ".cython.score-191 {background-color: #FFFF0c;}\n",
       ".cython.score-192 {background-color: #FFFF0c;}\n",
       ".cython.score-193 {background-color: #FFFF0c;}\n",
       ".cython.score-194 {background-color: #FFFF0c;}\n",
       ".cython.score-195 {background-color: #FFFF0c;}\n",
       ".cython.score-196 {background-color: #FFFF0c;}\n",
       ".cython.score-197 {background-color: #FFFF0c;}\n",
       ".cython.score-198 {background-color: #FFFF0c;}\n",
       ".cython.score-199 {background-color: #FFFF0c;}\n",
       ".cython.score-200 {background-color: #FFFF0c;}\n",
       ".cython.score-201 {background-color: #FFFF0c;}\n",
       ".cython.score-202 {background-color: #FFFF0c;}\n",
       ".cython.score-203 {background-color: #FFFF0b;}\n",
       ".cython.score-204 {background-color: #FFFF0b;}\n",
       ".cython.score-205 {background-color: #FFFF0b;}\n",
       ".cython.score-206 {background-color: #FFFF0b;}\n",
       ".cython.score-207 {background-color: #FFFF0b;}\n",
       ".cython.score-208 {background-color: #FFFF0b;}\n",
       ".cython.score-209 {background-color: #FFFF0b;}\n",
       ".cython.score-210 {background-color: #FFFF0b;}\n",
       ".cython.score-211 {background-color: #FFFF0b;}\n",
       ".cython.score-212 {background-color: #FFFF0b;}\n",
       ".cython.score-213 {background-color: #FFFF0b;}\n",
       ".cython.score-214 {background-color: #FFFF0b;}\n",
       ".cython.score-215 {background-color: #FFFF0b;}\n",
       ".cython.score-216 {background-color: #FFFF0b;}\n",
       ".cython.score-217 {background-color: #FFFF0b;}\n",
       ".cython.score-218 {background-color: #FFFF0b;}\n",
       ".cython.score-219 {background-color: #FFFF0b;}\n",
       ".cython.score-220 {background-color: #FFFF0b;}\n",
       ".cython.score-221 {background-color: #FFFF0b;}\n",
       ".cython.score-222 {background-color: #FFFF0a;}\n",
       ".cython.score-223 {background-color: #FFFF0a;}\n",
       ".cython.score-224 {background-color: #FFFF0a;}\n",
       ".cython.score-225 {background-color: #FFFF0a;}\n",
       ".cython.score-226 {background-color: #FFFF0a;}\n",
       ".cython.score-227 {background-color: #FFFF0a;}\n",
       ".cython.score-228 {background-color: #FFFF0a;}\n",
       ".cython.score-229 {background-color: #FFFF0a;}\n",
       ".cython.score-230 {background-color: #FFFF0a;}\n",
       ".cython.score-231 {background-color: #FFFF0a;}\n",
       ".cython.score-232 {background-color: #FFFF0a;}\n",
       ".cython.score-233 {background-color: #FFFF0a;}\n",
       ".cython.score-234 {background-color: #FFFF0a;}\n",
       ".cython.score-235 {background-color: #FFFF0a;}\n",
       ".cython.score-236 {background-color: #FFFF0a;}\n",
       ".cython.score-237 {background-color: #FFFF0a;}\n",
       ".cython.score-238 {background-color: #FFFF0a;}\n",
       ".cython.score-239 {background-color: #FFFF0a;}\n",
       ".cython.score-240 {background-color: #FFFF0a;}\n",
       ".cython.score-241 {background-color: #FFFF0a;}\n",
       ".cython.score-242 {background-color: #FFFF0a;}\n",
       ".cython.score-243 {background-color: #FFFF0a;}\n",
       ".cython.score-244 {background-color: #FFFF0a;}\n",
       ".cython.score-245 {background-color: #FFFF0a;}\n",
       ".cython.score-246 {background-color: #FFFF09;}\n",
       ".cython.score-247 {background-color: #FFFF09;}\n",
       ".cython.score-248 {background-color: #FFFF09;}\n",
       ".cython.score-249 {background-color: #FFFF09;}\n",
       ".cython.score-250 {background-color: #FFFF09;}\n",
       ".cython.score-251 {background-color: #FFFF09;}\n",
       ".cython.score-252 {background-color: #FFFF09;}\n",
       ".cython.score-253 {background-color: #FFFF09;}\n",
       ".cython.score-254 {background-color: #FFFF09;}\n",
       "pre { line-height: 125%; }\n",
       "td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }\n",
       "span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }\n",
       "td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }\n",
       "span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }\n",
       ".cython .hll { background-color: #ffffcc }\n",
       ".cython { background: #f8f8f8; }\n",
       ".cython .c { color: #3D7B7B; font-style: italic } /* Comment */\n",
       ".cython .err { border: 1px solid #FF0000 } /* Error */\n",
       ".cython .k { color: #008000; font-weight: bold } /* Keyword */\n",
       ".cython .o { color: #666666 } /* Operator */\n",
       ".cython .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */\n",
       ".cython .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */\n",
       ".cython .cp { color: #9C6500 } /* Comment.Preproc */\n",
       ".cython .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */\n",
       ".cython .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */\n",
       ".cython .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */\n",
       ".cython .gd { color: #A00000 } /* Generic.Deleted */\n",
       ".cython .ge { font-style: italic } /* Generic.Emph */\n",
       ".cython .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */\n",
       ".cython .gr { color: #E40000 } /* Generic.Error */\n",
       ".cython .gh { color: #000080; font-weight: bold } /* Generic.Heading */\n",
       ".cython .gi { color: #008400 } /* Generic.Inserted */\n",
       ".cython .go { color: #717171 } /* Generic.Output */\n",
       ".cython .gp { color: #000080; font-weight: bold } /* Generic.Prompt */\n",
       ".cython .gs { font-weight: bold } /* Generic.Strong */\n",
       ".cython .gu { color: #800080; font-weight: bold } /* Generic.Subheading */\n",
       ".cython .gt { color: #0044DD } /* Generic.Traceback */\n",
       ".cython .kc { color: #008000; font-weight: bold } /* Keyword.Constant */\n",
       ".cython .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */\n",
       ".cython .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */\n",
       ".cython .kp { color: #008000 } /* Keyword.Pseudo */\n",
       ".cython .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */\n",
       ".cython .kt { color: #B00040 } /* Keyword.Type */\n",
       ".cython .m { color: #666666 } /* Literal.Number */\n",
       ".cython .s { color: #BA2121 } /* Literal.String */\n",
       ".cython .na { color: #687822 } /* Name.Attribute */\n",
       ".cython .nb { color: #008000 } /* Name.Builtin */\n",
       ".cython .nc { color: #0000FF; font-weight: bold } /* Name.Class */\n",
       ".cython .no { color: #880000 } /* Name.Constant */\n",
       ".cython .nd { color: #AA22FF } /* Name.Decorator */\n",
       ".cython .ni { color: #717171; font-weight: bold } /* Name.Entity */\n",
       ".cython .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */\n",
       ".cython .nf { color: #0000FF } /* Name.Function */\n",
       ".cython .nl { color: #767600 } /* Name.Label */\n",
       ".cython .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */\n",
       ".cython .nt { color: #008000; font-weight: bold } /* Name.Tag */\n",
       ".cython .nv { color: #19177C } /* Name.Variable */\n",
       ".cython .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */\n",
       ".cython .w { color: #bbbbbb } /* Text.Whitespace */\n",
       ".cython .mb { color: #666666 } /* Literal.Number.Bin */\n",
       ".cython .mf { color: #666666 } /* Literal.Number.Float */\n",
       ".cython .mh { color: #666666 } /* Literal.Number.Hex */\n",
       ".cython .mi { color: #666666 } /* Literal.Number.Integer */\n",
       ".cython .mo { color: #666666 } /* Literal.Number.Oct */\n",
       ".cython .sa { color: #BA2121 } /* Literal.String.Affix */\n",
       ".cython .sb { color: #BA2121 } /* Literal.String.Backtick */\n",
       ".cython .sc { color: #BA2121 } /* Literal.String.Char */\n",
       ".cython .dl { color: #BA2121 } /* Literal.String.Delimiter */\n",
       ".cython .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */\n",
       ".cython .s2 { color: #BA2121 } /* Literal.String.Double */\n",
       ".cython .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */\n",
       ".cython .sh { color: #BA2121 } /* Literal.String.Heredoc */\n",
       ".cython .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */\n",
       ".cython .sx { color: #008000 } /* Literal.String.Other */\n",
       ".cython .sr { color: #A45A77 } /* Literal.String.Regex */\n",
       ".cython .s1 { color: #BA2121 } /* Literal.String.Single */\n",
       ".cython .ss { color: #19177C } /* Literal.String.Symbol */\n",
       ".cython .bp { color: #008000 } /* Name.Builtin.Pseudo */\n",
       ".cython .fm { color: #0000FF } /* Name.Function.Magic */\n",
       ".cython .vc { color: #19177C } /* Name.Variable.Class */\n",
       ".cython .vg { color: #19177C } /* Name.Variable.Global */\n",
       ".cython .vi { color: #19177C } /* Name.Variable.Instance */\n",
       ".cython .vm { color: #19177C } /* Name.Variable.Magic */\n",
       ".cython .il { color: #666666 } /* Literal.Number.Integer.Long */\n",
       "    </style>\n",
       "</head>\n",
       "<body class=\"cython\">\n",
       "<p><span style=\"border-bottom: solid 1px grey;\">Generated by Cython 3.0.3</span></p>\n",
       "<p>\n",
       "    <span style=\"background-color: #FFFF00\">Yellow lines</span> hint at Python interaction.<br />\n",
       "    Click on a line that starts with a \"<code>+</code>\" to see the C code that Cython generated for it.\n",
       "</p>\n",
       "<div class=\"cython\"><pre class=\"cython line score-16\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">01</span>: <span class=\"k\">import</span> <span class=\"nn\">numpy</span> <span class=\"k\">as</span> <span class=\"nn\">np</span></pre>\n",
       "<pre class='cython code score-16 '>  __pyx_t_7 = <span class='pyx_c_api'>__Pyx_ImportDottedModule</span>(__pyx_n_s_numpy, NULL);<span class='error_goto'> if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_7);\n",
       "  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_np, __pyx_t_7) &lt; 0) <span class='error_goto'>__PYX_ERR(0, 1, __pyx_L1_error)</span>\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;\n",
       "/* … */\n",
       "  __pyx_t_7 = <span class='pyx_c_api'>__Pyx_PyDict_NewPresized</span>(0);<span class='error_goto'> if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_7);\n",
       "  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_test, __pyx_t_7) &lt; 0) <span class='error_goto'>__PYX_ERR(0, 1, __pyx_L1_error)</span>\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;\n",
       "</pre><pre class=\"cython line score-0\">&#xA0;<span class=\"\">02</span>: <span class=\"k\">cimport</span> <span class=\"nn\">cython</span></pre>\n",
       "<pre class=\"cython line score-0\">&#xA0;<span class=\"\">03</span>: <span class=\"k\">from</span> <span class=\"nn\">libc.math</span> <span class=\"k\">cimport</span> <span class=\"n\">exp</span><span class=\"p\">,</span> <span class=\"n\">sqrt</span></pre>\n",
       "<pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">04</span>: <span class=\"k\">cdef</span> <span class=\"kt\">float</span> <span class=\"nf\">S0</span> <span class=\"o\">=</span> <span class=\"mf\">36.</span></pre>\n",
       "<pre class='cython code score-0 '>  __pyx_v_54_cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69_S0 = 36.;\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">05</span>: <span class=\"k\">cdef</span> <span class=\"kt\">float</span> <span class=\"nf\">T</span> <span class=\"o\">=</span> <span class=\"mf\">1.0</span></pre>\n",
       "<pre class='cython code score-0 '>  __pyx_v_54_cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69_T = 1.0;\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">06</span>: <span class=\"k\">cdef</span> <span class=\"kt\">float</span> <span class=\"nf\">r</span> <span class=\"o\">=</span> <span class=\"mf\">0.06</span></pre>\n",
       "<pre class='cython code score-0 '>  __pyx_v_54_cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69_r = 0.06;\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">07</span>: <span class=\"k\">cdef</span> <span class=\"kt\">float</span> <span class=\"nf\">sigma</span> <span class=\"o\">=</span> <span class=\"mf\">0.2</span></pre>\n",
       "<pre class='cython code score-0 '>  __pyx_v_54_cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69_sigma = 0.2;\n",
       "</pre><pre class=\"cython line score-60\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">08</span>: <span class=\"k\">def</span> <span class=\"nf\">simulate_tree_cy</span><span class=\"p\">(</span><span class=\"nb\">int</span> <span class=\"n\">M</span><span class=\"p\">):</span></pre>\n",
       "<pre class='cython code score-60 '>/* Python wrapper */\n",
       "static PyObject *__pyx_pw_54_cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69_1simulate_tree_cy(PyObject *__pyx_self, \n",
       "#if CYTHON_METH_FASTCALL\n",
       "PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds\n",
       "#else\n",
       "PyObject *__pyx_args, PyObject *__pyx_kwds\n",
       "#endif\n",
       "); /*proto*/\n",
       "static PyMethodDef __pyx_mdef_54_cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69_1simulate_tree_cy = {\"simulate_tree_cy\", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_54_cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69_1simulate_tree_cy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};\n",
       "static PyObject *__pyx_pw_54_cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69_1simulate_tree_cy(PyObject *__pyx_self, \n",
       "#if CYTHON_METH_FASTCALL\n",
       "PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds\n",
       "#else\n",
       "PyObject *__pyx_args, PyObject *__pyx_kwds\n",
       "#endif\n",
       ") {\n",
       "  int __pyx_v_M;\n",
       "  #if !CYTHON_METH_FASTCALL\n",
       "  CYTHON_UNUSED Py_ssize_t __pyx_nargs;\n",
       "  #endif\n",
       "  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;\n",
       "  PyObject *__pyx_r = 0;\n",
       "  <span class='refnanny'>__Pyx_RefNannyDeclarations</span>\n",
       "  <span class='refnanny'>__Pyx_RefNannySetupContext</span>(\"simulate_tree_cy (wrapper)\", 0);\n",
       "  #if !CYTHON_METH_FASTCALL\n",
       "  #if CYTHON_ASSUME_SAFE_MACROS\n",
       "  __pyx_nargs = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args);\n",
       "  #else\n",
       "  __pyx_nargs = <span class='py_c_api'>PyTuple_Size</span>(__pyx_args); if (unlikely(__pyx_nargs &lt; 0)) return NULL;\n",
       "  #endif\n",
       "  #endif\n",
       "  __pyx_kwvalues = <span class='pyx_c_api'>__Pyx_KwValues_FASTCALL</span>(__pyx_args, __pyx_nargs);\n",
       "  {\n",
       "    PyObject **__pyx_pyargnames[] = {&amp;__pyx_n_s_M,0};\n",
       "  PyObject* values[1] = {0};\n",
       "    if (__pyx_kwds) {\n",
       "      Py_ssize_t kw_args;\n",
       "      switch (__pyx_nargs) {\n",
       "        case  1: values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);\n",
       "        CYTHON_FALLTHROUGH;\n",
       "        case  0: break;\n",
       "        default: goto __pyx_L5_argtuple_error;\n",
       "      }\n",
       "      kw_args = <span class='pyx_c_api'>__Pyx_NumKwargs_FASTCALL</span>(__pyx_kwds);\n",
       "      switch (__pyx_nargs) {\n",
       "        case  0:\n",
       "        if (likely((values[0] = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_M)) != 0)) {\n",
       "          (void)<span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(values[0]);\n",
       "          kw_args--;\n",
       "        }\n",
       "        else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 8, __pyx_L3_error)</span>\n",
       "        else goto __pyx_L5_argtuple_error;\n",
       "      }\n",
       "      if (unlikely(kw_args &gt; 0)) {\n",
       "        const Py_ssize_t kwd_pos_args = __pyx_nargs;\n",
       "        if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, \"simulate_tree_cy\") &lt; 0)) <span class='error_goto'>__PYX_ERR(0, 8, __pyx_L3_error)</span>\n",
       "      }\n",
       "    } else if (unlikely(__pyx_nargs != 1)) {\n",
       "      goto __pyx_L5_argtuple_error;\n",
       "    } else {\n",
       "      values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);\n",
       "    }\n",
       "    __pyx_v_M = <span class='pyx_c_api'>__Pyx_PyInt_As_int</span>(values[0]); if (unlikely((__pyx_v_M == (int)-1) &amp;&amp; <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 8, __pyx_L3_error)</span>\n",
       "  }\n",
       "  goto __pyx_L6_skip;\n",
       "  __pyx_L5_argtuple_error:;\n",
       "  <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>(\"simulate_tree_cy\", 1, 1, 1, __pyx_nargs); <span class='error_goto'>__PYX_ERR(0, 8, __pyx_L3_error)</span>\n",
       "  __pyx_L6_skip:;\n",
       "  goto __pyx_L4_argument_unpacking_done;\n",
       "  __pyx_L3_error:;\n",
       "  {\n",
       "    Py_ssize_t __pyx_temp;\n",
       "    for (__pyx_temp=0; __pyx_temp &lt; (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {\n",
       "      <span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);\n",
       "    }\n",
       "  }\n",
       "  <span class='pyx_c_api'>__Pyx_AddTraceback</span>(\"_cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69.simulate_tree_cy\", __pyx_clineno, __pyx_lineno, __pyx_filename);\n",
       "  <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n",
       "  return NULL;\n",
       "  __pyx_L4_argument_unpacking_done:;\n",
       "  __pyx_r = __pyx_pf_54_cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69_simulate_tree_cy(__pyx_self, __pyx_v_M);\n",
       "  int __pyx_lineno = 0;\n",
       "  const char *__pyx_filename = NULL;\n",
       "  int __pyx_clineno = 0;\n",
       "\n",
       "  /* function exit code */\n",
       "  {\n",
       "    Py_ssize_t __pyx_temp;\n",
       "    for (__pyx_temp=0; __pyx_temp &lt; (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {\n",
       "      <span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);\n",
       "    }\n",
       "  }\n",
       "  <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n",
       "  return __pyx_r;\n",
       "}\n",
       "\n",
       "static PyObject *__pyx_pf_54_cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69_simulate_tree_cy(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_M) {\n",
       "  int __pyx_v_z;\n",
       "  int __pyx_v_t;\n",
       "  int __pyx_v_i;\n",
       "  float __pyx_v_dt;\n",
       "  float __pyx_v_u;\n",
       "  float __pyx_v_d;\n",
       "  __Pyx_memviewslice __pyx_v_S = { 0, 0, { 0 }, { 0 }, { 0 } };\n",
       "  PyObject *__pyx_r = NULL;\n",
       "/* … */\n",
       "  /* function exit code */\n",
       "  __pyx_L1_error:;\n",
       "  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);\n",
       "  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);\n",
       "  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3);\n",
       "  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4);\n",
       "  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_5);\n",
       "  __PYX_XCLEAR_MEMVIEW(&amp;__pyx_t_6, 1);\n",
       "  <span class='pyx_c_api'>__Pyx_AddTraceback</span>(\"_cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69.simulate_tree_cy\", __pyx_clineno, __pyx_lineno, __pyx_filename);\n",
       "  __pyx_r = NULL;\n",
       "  __pyx_L0:;\n",
       "  __PYX_XCLEAR_MEMVIEW(&amp;__pyx_v_S, 1);\n",
       "  <span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);\n",
       "  <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n",
       "  return __pyx_r;\n",
       "}\n",
       "/* … */\n",
       "  __pyx_tuple__20 = <span class='py_c_api'>PyTuple_Pack</span>(8, __pyx_n_s_M, __pyx_n_s_z, __pyx_n_s_t, __pyx_n_s_i, __pyx_n_s_dt, __pyx_n_s_u, __pyx_n_s_d, __pyx_n_s_S);<span class='error_goto'> if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 8, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_tuple__20);\n",
       "  <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_tuple__20);\n",
       "/* … */\n",
       "  __pyx_t_7 = <span class='pyx_c_api'>__Pyx_CyFunction_New</span>(&amp;__pyx_mdef_54_cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69_1simulate_tree_cy, 0, __pyx_n_s_simulate_tree_cy, NULL, __pyx_n_s_cython_magic_bb08fe28e1ca634eaf, __pyx_d, ((PyObject *)__pyx_codeobj__21));<span class='error_goto'> if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 8, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_7);\n",
       "  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_simulate_tree_cy, __pyx_t_7) &lt; 0) <span class='error_goto'>__PYX_ERR(0, 8, __pyx_L1_error)</span>\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;\n",
       "</pre><pre class=\"cython line score-0\">&#xA0;<span class=\"\">09</span>:     <span class=\"k\">cdef</span> <span class=\"kt\">int</span> <span class=\"nf\">z</span><span class=\"p\">,</span> <span class=\"nf\">t</span><span class=\"p\">,</span> <span class=\"nf\">i</span></pre>\n",
       "<pre class=\"cython line score-0\">&#xA0;<span class=\"\">10</span>:     <span class=\"k\">cdef</span> <span class=\"kt\">float</span> <span class=\"nf\">dt</span><span class=\"p\">,</span> <span class=\"nf\">u</span><span class=\"p\">,</span> <span class=\"nf\">d</span></pre>\n",
       "<pre class=\"cython line score-33\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">11</span>:     <span class=\"k\">cdef</span> <span class=\"kt\">float</span>[<span class=\"p\">:,</span> <span class=\"p\">:]</span> <span class=\"n\">S</span> <span class=\"o\">=</span> <span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">zeros</span><span class=\"p\">((</span><span class=\"n\">M</span> <span class=\"o\">+</span> <span class=\"mf\">1</span><span class=\"p\">,</span> <span class=\"n\">M</span> <span class=\"o\">+</span> <span class=\"mf\">1</span><span class=\"p\">),</span></pre>\n",
       "<pre class='cython code score-33 '>  <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_1, __pyx_n_s_np);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);\n",
       "  __pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_1, __pyx_n_s_zeros);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;\n",
       "  __pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyInt_From_long</span>((__pyx_v_M + 1));<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);\n",
       "  __pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyInt_From_long</span>((__pyx_v_M + 1));<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 11, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);\n",
       "  __pyx_t_4 = <span class='py_c_api'>PyTuple_New</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 11, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n",
       "  <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_1);\n",
       "  if (<span class='pyx_c_api'>__Pyx_PyTuple_SET_ITEM</span>(__pyx_t_4, 0, __pyx_t_1)) <span class='error_goto'>__PYX_ERR(0, 11, __pyx_L1_error)</span>;\n",
       "  <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_3);\n",
       "  if (<span class='pyx_c_api'>__Pyx_PyTuple_SET_ITEM</span>(__pyx_t_4, 1, __pyx_t_3)) <span class='error_goto'>__PYX_ERR(0, 11, __pyx_L1_error)</span>;\n",
       "  __pyx_t_1 = 0;\n",
       "  __pyx_t_3 = 0;\n",
       "  __pyx_t_3 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 11, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);\n",
       "  <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_4);\n",
       "  if (<span class='pyx_c_api'>__Pyx_PyTuple_SET_ITEM</span>(__pyx_t_3, 0, __pyx_t_4)) <span class='error_goto'>__PYX_ERR(0, 11, __pyx_L1_error)</span>;\n",
       "  __pyx_t_4 = 0;\n",
       "/* … */\n",
       "  __pyx_t_5 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_2, __pyx_t_3, __pyx_t_4);<span class='error_goto'> if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 11, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_5);\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n",
       "  __pyx_t_6 = <span class='pyx_c_api'>__Pyx_PyObject_to_MemoryviewSlice_dsds_float</span>(__pyx_t_5, PyBUF_WRITABLE);<span class='error_goto'> if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 11, __pyx_L1_error)</span>\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0;\n",
       "  __pyx_v_S = __pyx_t_6;\n",
       "  __pyx_t_6.memview = NULL;\n",
       "  __pyx_t_6.data = NULL;\n",
       "</pre><pre class=\"cython line score-13\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">12</span>:                                   <span class=\"n\">dtype</span><span class=\"o\">=</span><span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">float32</span><span class=\"p\">)</span></pre>\n",
       "<pre class='cython code score-13 '>  __pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyDict_NewPresized</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 12, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n",
       "  <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_1, __pyx_n_s_np);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);\n",
       "  __pyx_t_5 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_1, __pyx_n_s_float32);<span class='error_goto'> if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 12, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_5);\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;\n",
       "  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) &lt; 0) <span class='error_goto'>__PYX_ERR(0, 12, __pyx_L1_error)</span>\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0;\n",
       "</pre><pre class=\"cython line score-5\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">13</span>:     <span class=\"n\">dt</span> <span class=\"o\">=</span> <span class=\"n\">T</span> <span class=\"o\">/</span> <span class=\"n\">M</span></pre>\n",
       "<pre class='cython code score-5 '>  if (unlikely(__pyx_v_M == 0)) {\n",
       "    <span class='py_c_api'>PyErr_SetString</span>(PyExc_ZeroDivisionError, \"float division\");\n",
       "    <span class='error_goto'>__PYX_ERR(0, 13, __pyx_L1_error)</span>\n",
       "  }\n",
       "  __pyx_v_dt = (__pyx_v_54_cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69_T / ((float)__pyx_v_M));\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">14</span>:     <span class=\"n\">u</span> <span class=\"o\">=</span> <span class=\"n\">exp</span><span class=\"p\">(</span><span class=\"n\">sigma</span> <span class=\"o\">*</span> <span class=\"n\">sqrt</span><span class=\"p\">(</span><span class=\"n\">dt</span><span class=\"p\">))</span></pre>\n",
       "<pre class='cython code score-0 '>  __pyx_v_u = exp((__pyx_v_54_cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69_sigma * sqrt(__pyx_v_dt)));\n",
       "</pre><pre class=\"cython line score-5\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">15</span>:     <span class=\"n\">d</span> <span class=\"o\">=</span> <span class=\"mf\">1</span> <span class=\"o\">/</span> <span class=\"n\">u</span></pre>\n",
       "<pre class='cython code score-5 '>  if (unlikely(__pyx_v_u == 0)) {\n",
       "    <span class='py_c_api'>PyErr_SetString</span>(PyExc_ZeroDivisionError, \"float division\");\n",
       "    <span class='error_goto'>__PYX_ERR(0, 15, __pyx_L1_error)</span>\n",
       "  }\n",
       "  __pyx_v_d = (1.0 / __pyx_v_u);\n",
       "</pre><pre class=\"cython line score-2\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">16</span>:     <span class=\"n\">S</span><span class=\"p\">[</span><span class=\"mf\">0</span><span class=\"p\">,</span> <span class=\"mf\">0</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"n\">S0</span></pre>\n",
       "<pre class='cython code score-2 '>  __pyx_t_7 = 0;\n",
       "  __pyx_t_8 = 0;\n",
       "  __pyx_t_9 = -1;\n",
       "  if (__pyx_t_7 &lt; 0) {\n",
       "    __pyx_t_7 += __pyx_v_S.shape[0];\n",
       "    if (unlikely(__pyx_t_7 &lt; 0)) __pyx_t_9 = 0;\n",
       "  } else if (unlikely(__pyx_t_7 &gt;= __pyx_v_S.shape[0])) __pyx_t_9 = 0;\n",
       "  if (__pyx_t_8 &lt; 0) {\n",
       "    __pyx_t_8 += __pyx_v_S.shape[1];\n",
       "    if (unlikely(__pyx_t_8 &lt; 0)) __pyx_t_9 = 1;\n",
       "  } else if (unlikely(__pyx_t_8 &gt;= __pyx_v_S.shape[1])) __pyx_t_9 = 1;\n",
       "  if (unlikely(__pyx_t_9 != -1)) {\n",
       "    <span class='pyx_c_api'>__Pyx_RaiseBufferIndexError</span>(__pyx_t_9);\n",
       "    <span class='error_goto'>__PYX_ERR(0, 16, __pyx_L1_error)</span>\n",
       "  }\n",
       "  *((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_S.data + __pyx_t_7 * __pyx_v_S.strides[0]) ) + __pyx_t_8 * __pyx_v_S.strides[1]) )) = __pyx_v_54_cython_magic_bb08fe28e1ca634eaf243db97819bde37341ab69_S0;\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">17</span>:     <span class=\"n\">z</span> <span class=\"o\">=</span> <span class=\"mf\">1</span></pre>\n",
       "<pre class='cython code score-0 '>  __pyx_v_z = 1;\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">18</span>:     <span class=\"k\">for</span> <span class=\"n\">t</span> <span class=\"ow\">in</span> <span class=\"nb\">range</span><span class=\"p\">(</span><span class=\"mf\">1</span><span class=\"p\">,</span> <span class=\"n\">M</span> <span class=\"o\">+</span> <span class=\"mf\">1</span><span class=\"p\">):</span></pre>\n",
       "<pre class='cython code score-0 '>  __pyx_t_10 = (__pyx_v_M + 1);\n",
       "  __pyx_t_11 = __pyx_t_10;\n",
       "  for (__pyx_t_9 = 1; __pyx_t_9 &lt; __pyx_t_11; __pyx_t_9+=1) {\n",
       "    __pyx_v_t = __pyx_t_9;\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">19</span>:         <span class=\"k\">for</span> <span class=\"n\">i</span> <span class=\"ow\">in</span> <span class=\"nb\">range</span><span class=\"p\">(</span><span class=\"n\">z</span><span class=\"p\">):</span></pre>\n",
       "<pre class='cython code score-0 '>    __pyx_t_12 = __pyx_v_z;\n",
       "    __pyx_t_13 = __pyx_t_12;\n",
       "    for (__pyx_t_14 = 0; __pyx_t_14 &lt; __pyx_t_13; __pyx_t_14+=1) {\n",
       "      __pyx_v_i = __pyx_t_14;\n",
       "</pre><pre class=\"cython line score-4\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">20</span>:             <span class=\"n\">S</span><span class=\"p\">[</span><span class=\"n\">i</span><span class=\"p\">,</span> <span class=\"n\">t</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"n\">S</span><span class=\"p\">[</span><span class=\"n\">i</span><span class=\"p\">,</span> <span class=\"n\">t</span><span class=\"o\">-</span><span class=\"mf\">1</span><span class=\"p\">]</span> <span class=\"o\">*</span> <span class=\"n\">u</span></pre>\n",
       "<pre class='cython code score-4 '>      __pyx_t_8 = __pyx_v_i;\n",
       "      __pyx_t_7 = (__pyx_v_t - 1);\n",
       "      __pyx_t_15 = -1;\n",
       "      if (__pyx_t_8 &lt; 0) {\n",
       "        __pyx_t_8 += __pyx_v_S.shape[0];\n",
       "        if (unlikely(__pyx_t_8 &lt; 0)) __pyx_t_15 = 0;\n",
       "      } else if (unlikely(__pyx_t_8 &gt;= __pyx_v_S.shape[0])) __pyx_t_15 = 0;\n",
       "      if (__pyx_t_7 &lt; 0) {\n",
       "        __pyx_t_7 += __pyx_v_S.shape[1];\n",
       "        if (unlikely(__pyx_t_7 &lt; 0)) __pyx_t_15 = 1;\n",
       "      } else if (unlikely(__pyx_t_7 &gt;= __pyx_v_S.shape[1])) __pyx_t_15 = 1;\n",
       "      if (unlikely(__pyx_t_15 != -1)) {\n",
       "        <span class='pyx_c_api'>__Pyx_RaiseBufferIndexError</span>(__pyx_t_15);\n",
       "        <span class='error_goto'>__PYX_ERR(0, 20, __pyx_L1_error)</span>\n",
       "      }\n",
       "      __pyx_t_16 = __pyx_v_i;\n",
       "      __pyx_t_17 = __pyx_v_t;\n",
       "      __pyx_t_15 = -1;\n",
       "      if (__pyx_t_16 &lt; 0) {\n",
       "        __pyx_t_16 += __pyx_v_S.shape[0];\n",
       "        if (unlikely(__pyx_t_16 &lt; 0)) __pyx_t_15 = 0;\n",
       "      } else if (unlikely(__pyx_t_16 &gt;= __pyx_v_S.shape[0])) __pyx_t_15 = 0;\n",
       "      if (__pyx_t_17 &lt; 0) {\n",
       "        __pyx_t_17 += __pyx_v_S.shape[1];\n",
       "        if (unlikely(__pyx_t_17 &lt; 0)) __pyx_t_15 = 1;\n",
       "      } else if (unlikely(__pyx_t_17 &gt;= __pyx_v_S.shape[1])) __pyx_t_15 = 1;\n",
       "      if (unlikely(__pyx_t_15 != -1)) {\n",
       "        <span class='pyx_c_api'>__Pyx_RaiseBufferIndexError</span>(__pyx_t_15);\n",
       "        <span class='error_goto'>__PYX_ERR(0, 20, __pyx_L1_error)</span>\n",
       "      }\n",
       "      *((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_S.data + __pyx_t_16 * __pyx_v_S.strides[0]) ) + __pyx_t_17 * __pyx_v_S.strides[1]) )) = ((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_S.data + __pyx_t_8 * __pyx_v_S.strides[0]) ) + __pyx_t_7 * __pyx_v_S.strides[1]) ))) * __pyx_v_u);\n",
       "</pre><pre class=\"cython line score-4\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">21</span>:             <span class=\"n\">S</span><span class=\"p\">[</span><span class=\"n\">i</span><span class=\"o\">+</span><span class=\"mf\">1</span><span class=\"p\">,</span> <span class=\"n\">t</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"n\">S</span><span class=\"p\">[</span><span class=\"n\">i</span><span class=\"p\">,</span> <span class=\"n\">t</span><span class=\"o\">-</span><span class=\"mf\">1</span><span class=\"p\">]</span> <span class=\"o\">*</span> <span class=\"n\">d</span></pre>\n",
       "<pre class='cython code score-4 '>      __pyx_t_7 = __pyx_v_i;\n",
       "      __pyx_t_8 = (__pyx_v_t - 1);\n",
       "      __pyx_t_15 = -1;\n",
       "      if (__pyx_t_7 &lt; 0) {\n",
       "        __pyx_t_7 += __pyx_v_S.shape[0];\n",
       "        if (unlikely(__pyx_t_7 &lt; 0)) __pyx_t_15 = 0;\n",
       "      } else if (unlikely(__pyx_t_7 &gt;= __pyx_v_S.shape[0])) __pyx_t_15 = 0;\n",
       "      if (__pyx_t_8 &lt; 0) {\n",
       "        __pyx_t_8 += __pyx_v_S.shape[1];\n",
       "        if (unlikely(__pyx_t_8 &lt; 0)) __pyx_t_15 = 1;\n",
       "      } else if (unlikely(__pyx_t_8 &gt;= __pyx_v_S.shape[1])) __pyx_t_15 = 1;\n",
       "      if (unlikely(__pyx_t_15 != -1)) {\n",
       "        <span class='pyx_c_api'>__Pyx_RaiseBufferIndexError</span>(__pyx_t_15);\n",
       "        <span class='error_goto'>__PYX_ERR(0, 21, __pyx_L1_error)</span>\n",
       "      }\n",
       "      __pyx_t_17 = (__pyx_v_i + 1);\n",
       "      __pyx_t_16 = __pyx_v_t;\n",
       "      __pyx_t_15 = -1;\n",
       "      if (__pyx_t_17 &lt; 0) {\n",
       "        __pyx_t_17 += __pyx_v_S.shape[0];\n",
       "        if (unlikely(__pyx_t_17 &lt; 0)) __pyx_t_15 = 0;\n",
       "      } else if (unlikely(__pyx_t_17 &gt;= __pyx_v_S.shape[0])) __pyx_t_15 = 0;\n",
       "      if (__pyx_t_16 &lt; 0) {\n",
       "        __pyx_t_16 += __pyx_v_S.shape[1];\n",
       "        if (unlikely(__pyx_t_16 &lt; 0)) __pyx_t_15 = 1;\n",
       "      } else if (unlikely(__pyx_t_16 &gt;= __pyx_v_S.shape[1])) __pyx_t_15 = 1;\n",
       "      if (unlikely(__pyx_t_15 != -1)) {\n",
       "        <span class='pyx_c_api'>__Pyx_RaiseBufferIndexError</span>(__pyx_t_15);\n",
       "        <span class='error_goto'>__PYX_ERR(0, 21, __pyx_L1_error)</span>\n",
       "      }\n",
       "      *((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_S.data + __pyx_t_17 * __pyx_v_S.strides[0]) ) + __pyx_t_16 * __pyx_v_S.strides[1]) )) = ((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_S.data + __pyx_t_7 * __pyx_v_S.strides[0]) ) + __pyx_t_8 * __pyx_v_S.strides[1]) ))) * __pyx_v_d);\n",
       "    }\n",
       "</pre><pre class=\"cython line score-0\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">22</span>:         <span class=\"n\">z</span> <span class=\"o\">+=</span> <span class=\"mf\">1</span></pre>\n",
       "<pre class='cython code score-0 '>    __pyx_v_z = (__pyx_v_z + 1);\n",
       "  }\n",
       "</pre><pre class=\"cython line score-21\" onclick=\"(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)\">+<span class=\"\">23</span>:     <span class=\"k\">return</span> <span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">array</span><span class=\"p\">(</span><span class=\"n\">S</span><span class=\"p\">)</span></pre>\n",
       "<pre class='cython code score-21 '>  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);\n",
       "  <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_4, __pyx_n_s_np);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n",
       "  __pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_4, __pyx_n_s_array);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);\n",
       "  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n",
       "  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_S, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);;<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error)</span>\n",
       "  <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n",
       "  __pyx_t_2 = NULL;\n",
       "  __pyx_t_9 = 0;\n",
       "  #if CYTHON_UNPACK_METHODS\n",
       "  if (unlikely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_3))) {\n",
       "    __pyx_t_2 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_3);\n",
       "    if (likely(__pyx_t_2)) {\n",
       "      PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_3);\n",
       "      <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_2);\n",
       "      <span class='pyx_macro_api'>__Pyx_INCREF</span>(function);\n",
       "      <span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_3, function);\n",
       "      __pyx_t_9 = 1;\n",
       "    }\n",
       "  }\n",
       "  #endif\n",
       "  {\n",
       "    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};\n",
       "    __pyx_t_5 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_3, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);\n",
       "    <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n",
       "    <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n",
       "    if (unlikely(!__pyx_t_5)) <span class='error_goto'>__PYX_ERR(0, 23, __pyx_L1_error)</span>\n",
       "    <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_5);\n",
       "    <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;\n",
       "  }\n",
       "  __pyx_r = __pyx_t_5;\n",
       "  __pyx_t_5 = 0;\n",
       "  goto __pyx_L0;\n",
       "</pre></div></body></html>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "execution_count": 117,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%%cython -a\n",
    "import numpy as np\n",
    "cimport cython\n",
    "from libc.math cimport exp, sqrt\n",
    "cdef float S0 = 36.\n",
    "cdef float T = 1.0\n",
    "cdef float r = 0.06\n",
    "cdef float sigma = 0.2\n",
    "def simulate_tree_cy(int M):\n",
    "    cdef int z, t, i\n",
    "    cdef float dt, u, d\n",
    "    cdef float[:, :] S = np.zeros((M + 1, M + 1),\n",
    "                                  dtype=np.float32)  \n",
    "    dt = T / M\n",
    "    u = exp(sigma * sqrt(dt))\n",
    "    d = 1 / u\n",
    "    S[0, 0] = S0\n",
    "    z = 1\n",
    "    for t in range(1, M + 1):\n",
    "        for i in range(z):\n",
    "            S[i, t] = S[i, t-1] * u\n",
    "            S[i+1, t] = S[i, t-1] * d\n",
    "        z += 1\n",
    "    return np.array(S)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 36.00,  39.79,  43.97,  48.59,  53.71],\n",
       "       [  0.00,  32.57,  36.00,  39.79,  43.97],\n",
       "       [  0.00,   0.00,  29.47,  32.57,  36.00],\n",
       "       [  0.00,   0.00,   0.00,  26.67,  29.47],\n",
       "       [  0.00,   0.00,   0.00,   0.00,  24.13]], dtype=float32)"
      ]
     },
     "execution_count": 118,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "simulate_tree_cy(4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 364 µs, sys: 498 µs, total: 862 µs\n",
      "Wall time: 419 µs\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([[ 36.00,  36.32,  36.65, ..., 3095.77, 3123.59, 3151.65],\n",
       "       [  0.00,  35.68,  36.00, ..., 3040.89, 3068.21, 3095.77],\n",
       "       [  0.00,   0.00,  35.36, ..., 2986.97, 3013.81, 3040.89],\n",
       "       ...,\n",
       "       [  0.00,   0.00,   0.00, ...,   0.42,   0.42,   0.43],\n",
       "       [  0.00,   0.00,   0.00, ...,   0.00,   0.41,   0.42],\n",
       "       [  0.00,   0.00,   0.00, ...,   0.00,   0.00,   0.41]],\n",
       "      dtype=float32)"
      ]
     },
     "execution_count": 119,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%time simulate_tree_cy(500)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 120,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "90.9 µs ± 4.29 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n"
     ]
    }
   ],
   "source": [
    "%timeit S = simulate_tree_cy(500)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Monte Carlo Simulation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Python"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 121,
   "metadata": {},
   "outputs": [],
   "source": [
    "M = 100  \n",
    "I = 50000  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 122,
   "metadata": {},
   "outputs": [],
   "source": [
    "def mcs_simulation_py(p):\n",
    "    M, I = p\n",
    "    dt = T / M\n",
    "    S = np.zeros((M + 1, I))\n",
    "    S[0] = S0\n",
    "    rn = np.random.standard_normal(S.shape)  \n",
    "    for t in range(1, M + 1):  \n",
    "        for i in range(I):  \n",
    "            S[t, i] = S[t-1, i] * math.exp((r - sigma ** 2 / 2) * dt +\n",
    "                                         sigma * math.sqrt(dt) * rn[t, i])  \n",
    "    return S      "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 123,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 2.45 s, sys: 19.9 ms, total: 2.47 s\n",
      "Wall time: 2.46 s\n"
     ]
    }
   ],
   "source": [
    "%time S = mcs_simulation_py((M, I))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "38.24081388898043"
      ]
     },
     "execution_count": 124,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "S[-1].mean()  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 125,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "38.22611567563295"
      ]
     },
     "execution_count": 125,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "S0 * math.exp(r * T)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "metadata": {},
   "outputs": [],
   "source": [
    "K = 40.  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 127,
   "metadata": {},
   "outputs": [],
   "source": [
    "C0 = math.exp(-r * T) * np.maximum(K - S[-1], 0).mean()  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 128,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3.837586914897828"
      ]
     },
     "execution_count": 128,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "C0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x13ff49db0>"
      ]
     },
     "execution_count": 129,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"604.85pt\" height=\"363.718125pt\" viewBox=\"0 0 604.85 363.718125\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2023-10-15T07:43:10.153521</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.8.0, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 363.718125 \n",
       "L 604.85 363.718125 \n",
       "L 604.85 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 39.65 339.84 \n",
       "L 597.65 339.84 \n",
       "L 597.65 7.2 \n",
       "L 39.65 7.2 \n",
       "z\n",
       "\" style=\"fill: #eaeaf2\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <path d=\"M 84.00358 339.84 \n",
       "L 84.00358 7.2 \n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_2\"/>\n",
       "     <g id=\"text_1\">\n",
       "      <!-- 20 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(77.64108 354.438437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-32\" d=\"M 819 3553 \n",
       "L 469 3553 \n",
       "L 469 4384 \n",
       "Q 803 4563 1142 4656 \n",
       "Q 1481 4750 1806 4750 \n",
       "Q 2534 4750 2956 4397 \n",
       "Q 3378 4044 3378 3438 \n",
       "Q 3378 2753 2422 1800 \n",
       "Q 2347 1728 2309 1691 \n",
       "L 1131 513 \n",
       "L 3078 513 \n",
       "L 3078 1088 \n",
       "L 3444 1088 \n",
       "L 3444 0 \n",
       "L 434 0 \n",
       "L 434 341 \n",
       "L 1850 1753 \n",
       "Q 2319 2222 2519 2614 \n",
       "Q 2719 3006 2719 3438 \n",
       "Q 2719 3909 2473 4175 \n",
       "Q 2228 4441 1797 4441 \n",
       "Q 1350 4441 1106 4219 \n",
       "Q 863 3997 819 3553 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSerif-30\" d=\"M 2034 219 \n",
       "Q 2513 219 2750 744 \n",
       "Q 2988 1269 2988 2328 \n",
       "Q 2988 3391 2750 3916 \n",
       "Q 2513 4441 2034 4441 \n",
       "Q 1556 4441 1318 3916 \n",
       "Q 1081 3391 1081 2328 \n",
       "Q 1081 1269 1318 744 \n",
       "Q 1556 219 2034 219 \n",
       "z\n",
       "M 2034 -91 \n",
       "Q 1275 -91 848 546 \n",
       "Q 422 1184 422 2328 \n",
       "Q 422 3475 848 4112 \n",
       "Q 1275 4750 2034 4750 \n",
       "Q 2797 4750 3222 4112 \n",
       "Q 3647 3475 3647 2328 \n",
       "Q 3647 1184 3222 546 \n",
       "Q 2797 -91 2034 -91 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <path d=\"M 158.212441 339.84 \n",
       "L 158.212441 7.2 \n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_4\"/>\n",
       "     <g id=\"text_2\">\n",
       "      <!-- 30 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(151.849941 354.438437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-33\" d=\"M 622 4469 \n",
       "Q 988 4606 1323 4678 \n",
       "Q 1659 4750 1953 4750 \n",
       "Q 2638 4750 3022 4454 \n",
       "Q 3406 4159 3406 3634 \n",
       "Q 3406 3213 3140 2930 \n",
       "Q 2875 2647 2388 2547 \n",
       "Q 2963 2466 3280 2130 \n",
       "Q 3597 1794 3597 1259 \n",
       "Q 3597 606 3158 257 \n",
       "Q 2719 -91 1894 -91 \n",
       "Q 1528 -91 1179 -12 \n",
       "Q 831 66 488 225 \n",
       "L 488 1131 \n",
       "L 838 1131 \n",
       "Q 869 681 1141 450 \n",
       "Q 1413 219 1906 219 \n",
       "Q 2384 219 2661 495 \n",
       "Q 2938 772 2938 1253 \n",
       "Q 2938 1803 2653 2086 \n",
       "Q 2369 2369 1819 2369 \n",
       "L 1522 2369 \n",
       "L 1522 2688 \n",
       "L 1678 2688 \n",
       "Q 2225 2688 2498 2914 \n",
       "Q 2772 3141 2772 3597 \n",
       "Q 2772 4006 2547 4223 \n",
       "Q 2322 4441 1900 4441 \n",
       "Q 1478 4441 1245 4241 \n",
       "Q 1013 4041 972 3647 \n",
       "L 622 3647 \n",
       "L 622 4469 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-33\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <path d=\"M 232.421302 339.84 \n",
       "L 232.421302 7.2 \n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_6\"/>\n",
       "     <g id=\"text_3\">\n",
       "      <!-- 40 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(226.058802 354.438437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-34\" d=\"M 2234 1581 \n",
       "L 2234 4063 \n",
       "L 641 1581 \n",
       "L 2234 1581 \n",
       "z\n",
       "M 3609 0 \n",
       "L 1484 0 \n",
       "L 1484 331 \n",
       "L 2234 331 \n",
       "L 2234 1247 \n",
       "L 197 1247 \n",
       "L 197 1588 \n",
       "L 2241 4750 \n",
       "L 2859 4750 \n",
       "L 2859 1581 \n",
       "L 3750 1581 \n",
       "L 3750 1247 \n",
       "L 2859 1247 \n",
       "L 2859 331 \n",
       "L 3609 331 \n",
       "L 3609 0 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-34\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <path d=\"M 306.630163 339.84 \n",
       "L 306.630163 7.2 \n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_8\"/>\n",
       "     <g id=\"text_4\">\n",
       "      <!-- 50 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(300.267663 354.438437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-35\" d=\"M 3219 4666 \n",
       "L 3219 4153 \n",
       "L 1081 4153 \n",
       "L 1081 2816 \n",
       "Q 1244 2928 1461 2984 \n",
       "Q 1678 3041 1947 3041 \n",
       "Q 2703 3041 3140 2622 \n",
       "Q 3578 2203 3578 1478 \n",
       "Q 3578 738 3136 323 \n",
       "Q 2694 -91 1894 -91 \n",
       "Q 1572 -91 1234 -12 \n",
       "Q 897 66 544 225 \n",
       "L 544 1131 \n",
       "L 897 1131 \n",
       "Q 925 688 1179 453 \n",
       "Q 1434 219 1894 219 \n",
       "Q 2388 219 2653 544 \n",
       "Q 2919 869 2919 1478 \n",
       "Q 2919 2084 2655 2407 \n",
       "Q 2391 2731 1894 2731 \n",
       "Q 1613 2731 1398 2631 \n",
       "Q 1184 2531 1019 2322 \n",
       "L 750 2322 \n",
       "L 750 4666 \n",
       "L 3219 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-35\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <path d=\"M 380.839024 339.84 \n",
       "L 380.839024 7.2 \n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_10\"/>\n",
       "     <g id=\"text_5\">\n",
       "      <!-- 60 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(374.476524 354.438437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-36\" d=\"M 2094 219 \n",
       "Q 2534 219 2771 542 \n",
       "Q 3009 866 3009 1472 \n",
       "Q 3009 2078 2771 2401 \n",
       "Q 2534 2725 2094 2725 \n",
       "Q 1647 2725 1412 2412 \n",
       "Q 1178 2100 1178 1509 \n",
       "Q 1178 888 1415 553 \n",
       "Q 1653 219 2094 219 \n",
       "z\n",
       "M 1075 2569 \n",
       "Q 1288 2803 1556 2918 \n",
       "Q 1825 3034 2163 3034 \n",
       "Q 2859 3034 3264 2615 \n",
       "Q 3669 2197 3669 1472 \n",
       "Q 3669 763 3233 336 \n",
       "Q 2797 -91 2069 -91 \n",
       "Q 1278 -91 853 498 \n",
       "Q 428 1088 428 2181 \n",
       "Q 428 3406 931 4078 \n",
       "Q 1434 4750 2350 4750 \n",
       "Q 2597 4750 2869 4703 \n",
       "Q 3141 4656 3425 4563 \n",
       "L 3425 3794 \n",
       "L 3072 3794 \n",
       "Q 3034 4109 2831 4275 \n",
       "Q 2628 4441 2284 4441 \n",
       "Q 1678 4441 1381 3981 \n",
       "Q 1084 3522 1075 2569 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-36\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_6\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <path d=\"M 455.047885 339.84 \n",
       "L 455.047885 7.2 \n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_12\"/>\n",
       "     <g id=\"text_6\">\n",
       "      <!-- 70 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(448.685385 354.438437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-37\" d=\"M 3609 4347 \n",
       "L 1784 0 \n",
       "L 1319 0 \n",
       "L 3059 4153 \n",
       "L 903 4153 \n",
       "L 903 3578 \n",
       "L 538 3578 \n",
       "L 538 4666 \n",
       "L 3609 4666 \n",
       "L 3609 4347 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-37\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_7\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <path d=\"M 529.256746 339.84 \n",
       "L 529.256746 7.2 \n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_14\"/>\n",
       "     <g id=\"text_7\">\n",
       "      <!-- 80 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(522.894246 354.438437) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-38\" d=\"M 2981 1275 \n",
       "Q 2981 1775 2732 2051 \n",
       "Q 2484 2328 2034 2328 \n",
       "Q 1584 2328 1336 2051 \n",
       "Q 1088 1775 1088 1275 \n",
       "Q 1088 772 1336 495 \n",
       "Q 1584 219 2034 219 \n",
       "Q 2484 219 2732 495 \n",
       "Q 2981 772 2981 1275 \n",
       "z\n",
       "M 2853 3541 \n",
       "Q 2853 3966 2637 4203 \n",
       "Q 2422 4441 2034 4441 \n",
       "Q 1650 4441 1433 4203 \n",
       "Q 1216 3966 1216 3541 \n",
       "Q 1216 3113 1433 2875 \n",
       "Q 1650 2638 2034 2638 \n",
       "Q 2422 2638 2637 2875 \n",
       "Q 2853 3113 2853 3541 \n",
       "z\n",
       "M 2516 2484 \n",
       "Q 3047 2413 3344 2092 \n",
       "Q 3641 1772 3641 1275 \n",
       "Q 3641 619 3225 264 \n",
       "Q 2809 -91 2034 -91 \n",
       "Q 1263 -91 845 264 \n",
       "Q 428 619 428 1275 \n",
       "Q 428 1772 725 2092 \n",
       "Q 1022 2413 1556 2484 \n",
       "Q 1084 2569 832 2842 \n",
       "Q 581 3116 581 3541 \n",
       "Q 581 4103 968 4426 \n",
       "Q 1356 4750 2034 4750 \n",
       "Q 2713 4750 3100 4426 \n",
       "Q 3488 4103 3488 3541 \n",
       "Q 3488 3116 3236 2842 \n",
       "Q 2984 2569 2516 2484 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-38\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_15\">\n",
       "      <path d=\"M 39.65 339.84 \n",
       "L 597.65 339.84 \n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_16\"/>\n",
       "     <g id=\"text_8\">\n",
       "      <!-- 0 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(26.2875 343.639219) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-30\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_17\">\n",
       "      <path d=\"M 39.65 280.414001 \n",
       "L 597.65 280.414001 \n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_18\"/>\n",
       "     <g id=\"text_9\">\n",
       "      <!-- 1000 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(7.2 284.21322) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-31\" d=\"M 909 0 \n",
       "L 909 331 \n",
       "L 1722 331 \n",
       "L 1722 4213 \n",
       "L 781 3603 \n",
       "L 781 4013 \n",
       "L 1919 4750 \n",
       "L 2350 4750 \n",
       "L 2350 331 \n",
       "L 3163 331 \n",
       "L 3163 0 \n",
       "L 909 0 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"127.246094\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"190.869141\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_19\">\n",
       "      <path d=\"M 39.65 220.988002 \n",
       "L 597.65 220.988002 \n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_20\"/>\n",
       "     <g id=\"text_10\">\n",
       "      <!-- 2000 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(7.2 224.787221) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"127.246094\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"190.869141\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_21\">\n",
       "      <path d=\"M 39.65 161.562003 \n",
       "L 597.65 161.562003 \n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_22\"/>\n",
       "     <g id=\"text_11\">\n",
       "      <!-- 3000 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(7.2 165.361222) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-33\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"127.246094\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"190.869141\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_23\">\n",
       "      <path d=\"M 39.65 102.136005 \n",
       "L 597.65 102.136005 \n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_24\"/>\n",
       "     <g id=\"text_12\">\n",
       "      <!-- 4000 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(7.2 105.935223) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-34\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"127.246094\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"190.869141\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_25\">\n",
       "      <path d=\"M 39.65 42.710006 \n",
       "L 597.65 42.710006 \n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_26\"/>\n",
       "     <g id=\"text_13\">\n",
       "      <!-- 5000 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(7.2 46.509224) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-35\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"127.246094\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"190.869141\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 65.013636 339.84 \n",
       "L 79.507143 339.84 \n",
       "L 79.507143 338.413776 \n",
       "L 65.013636 338.413776 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 79.507143 339.84 \n",
       "L 94.000649 339.84 \n",
       "L 94.000649 333.778548 \n",
       "L 79.507143 333.778548 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 94.000649 339.84 \n",
       "L 108.494156 339.84 \n",
       "L 108.494156 319.0409 \n",
       "L 94.000649 319.0409 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 108.494156 339.84 \n",
       "L 122.987662 339.84 \n",
       "L 122.987662 293.368869 \n",
       "L 108.494156 293.368869 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_7\">\n",
       "    <path d=\"M 122.987662 339.84 \n",
       "L 137.481169 339.84 \n",
       "L 137.481169 251.354688 \n",
       "L 122.987662 251.354688 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_8\">\n",
       "    <path d=\"M 137.481169 339.84 \n",
       "L 151.974675 339.84 \n",
       "L 151.974675 193.533191 \n",
       "L 137.481169 193.533191 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_9\">\n",
       "    <path d=\"M 151.974675 339.84 \n",
       "L 166.468182 339.84 \n",
       "L 166.468182 127.570332 \n",
       "L 151.974675 127.570332 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_10\">\n",
       "    <path d=\"M 166.468182 339.84 \n",
       "L 180.961688 339.84 \n",
       "L 180.961688 76.820529 \n",
       "L 166.468182 76.820529 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_11\">\n",
       "    <path d=\"M 180.961688 339.84 \n",
       "L 195.455195 339.84 \n",
       "L 195.455195 36.173146 \n",
       "L 180.961688 36.173146 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_12\">\n",
       "    <path d=\"M 195.455195 339.84 \n",
       "L 209.948701 339.84 \n",
       "L 209.948701 23.04 \n",
       "L 195.455195 23.04 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_13\">\n",
       "    <path d=\"M 209.948701 339.84 \n",
       "L 224.442208 339.84 \n",
       "L 224.442208 37.064536 \n",
       "L 209.948701 37.064536 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_14\">\n",
       "    <path d=\"M 224.442208 339.84 \n",
       "L 238.935714 339.84 \n",
       "L 238.935714 67.609499 \n",
       "L 224.442208 67.609499 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_15\">\n",
       "    <path d=\"M 238.935714 339.84 \n",
       "L 253.429221 339.84 \n",
       "L 253.429221 103.205672 \n",
       "L 238.935714 103.205672 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_16\">\n",
       "    <path d=\"M 253.429221 339.84 \n",
       "L 267.922727 339.84 \n",
       "L 267.922727 139.752662 \n",
       "L 253.429221 139.752662 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_17\">\n",
       "    <path d=\"M 267.922727 339.84 \n",
       "L 282.416234 339.84 \n",
       "L 282.416234 182.539381 \n",
       "L 267.922727 182.539381 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_18\">\n",
       "    <path d=\"M 282.416234 339.84 \n",
       "L 296.90974 339.84 \n",
       "L 296.90974 226.692898 \n",
       "L 282.416234 226.692898 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_19\">\n",
       "    <path d=\"M 296.90974 339.84 \n",
       "L 311.403247 339.84 \n",
       "L 311.403247 250.225594 \n",
       "L 296.90974 250.225594 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_20\">\n",
       "    <path d=\"M 311.403247 339.84 \n",
       "L 325.896753 339.84 \n",
       "L 325.896753 276.610737 \n",
       "L 311.403247 276.610737 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_21\">\n",
       "    <path d=\"M 325.896753 339.84 \n",
       "L 340.39026 339.84 \n",
       "L 340.39026 298.479505 \n",
       "L 325.896753 298.479505 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_22\">\n",
       "    <path d=\"M 340.39026 339.84 \n",
       "L 354.883766 339.84 \n",
       "L 354.883766 309.592167 \n",
       "L 340.39026 309.592167 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_23\">\n",
       "    <path d=\"M 354.883766 339.84 \n",
       "L 369.377273 339.84 \n",
       "L 369.377273 320.051142 \n",
       "L 354.883766 320.051142 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_24\">\n",
       "    <path d=\"M 369.377273 339.84 \n",
       "L 383.870779 339.84 \n",
       "L 383.870779 326.112594 \n",
       "L 369.377273 326.112594 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_25\">\n",
       "    <path d=\"M 383.870779 339.84 \n",
       "L 398.364286 339.84 \n",
       "L 398.364286 330.391266 \n",
       "L 383.870779 330.391266 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_26\">\n",
       "    <path d=\"M 398.364286 339.84 \n",
       "L 412.857792 339.84 \n",
       "L 412.857792 333.837974 \n",
       "L 398.364286 333.837974 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_27\">\n",
       "    <path d=\"M 412.857792 339.84 \n",
       "L 427.351299 339.84 \n",
       "L 427.351299 336.452718 \n",
       "L 412.857792 336.452718 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_28\">\n",
       "    <path d=\"M 427.351299 339.84 \n",
       "L 441.844805 339.84 \n",
       "L 441.844805 337.878942 \n",
       "L 427.351299 337.878942 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_29\">\n",
       "    <path d=\"M 441.844805 339.84 \n",
       "L 456.338312 339.84 \n",
       "L 456.338312 337.997794 \n",
       "L 441.844805 337.997794 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_30\">\n",
       "    <path d=\"M 456.338312 339.84 \n",
       "L 470.831818 339.84 \n",
       "L 470.831818 338.829758 \n",
       "L 456.338312 338.829758 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_31\">\n",
       "    <path d=\"M 470.831818 339.84 \n",
       "L 485.325325 339.84 \n",
       "L 485.325325 338.829758 \n",
       "L 470.831818 338.829758 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_32\">\n",
       "    <path d=\"M 485.325325 339.84 \n",
       "L 499.818831 339.84 \n",
       "L 499.818831 339.54287 \n",
       "L 485.325325 339.54287 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_33\">\n",
       "    <path d=\"M 499.818831 339.84 \n",
       "L 514.312338 339.84 \n",
       "L 514.312338 339.424018 \n",
       "L 499.818831 339.424018 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_34\">\n",
       "    <path d=\"M 514.312338 339.84 \n",
       "L 528.805844 339.84 \n",
       "L 528.805844 339.661722 \n",
       "L 514.312338 339.661722 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_35\">\n",
       "    <path d=\"M 528.805844 339.84 \n",
       "L 543.299351 339.84 \n",
       "L 543.299351 339.780574 \n",
       "L 528.805844 339.780574 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_36\">\n",
       "    <path d=\"M 543.299351 339.84 \n",
       "L 557.792857 339.84 \n",
       "L 557.792857 339.721148 \n",
       "L 543.299351 339.721148 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_37\">\n",
       "    <path d=\"M 557.792857 339.84 \n",
       "L 572.286364 339.84 \n",
       "L 572.286364 339.721148 \n",
       "L 557.792857 339.721148 \n",
       "z\n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: #4c72b0\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_27\">\n",
       "    <path d=\"M 219.366582 339.84 \n",
       "L 219.366582 7.2 \n",
       "\" clip-path=\"url(#p35c8b023fb)\" style=\"fill: none; stroke: #ff0000; stroke-width: 1.75; stroke-linecap: round\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_38\">\n",
       "    <path d=\"M 39.65 339.84 \n",
       "L 39.65 7.2 \n",
       "\" style=\"fill: none\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_39\">\n",
       "    <path d=\"M 597.65 339.84 \n",
       "L 597.65 7.2 \n",
       "\" style=\"fill: none\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_40\">\n",
       "    <path d=\"M 39.65 339.84 \n",
       "L 597.65 339.84 \n",
       "\" style=\"fill: none\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_41\">\n",
       "    <path d=\"M 39.65 7.2 \n",
       "L 597.65 7.2 \n",
       "\" style=\"fill: none\"/>\n",
       "   </g>\n",
       "   <g id=\"legend_1\">\n",
       "    <g id=\"patch_42\">\n",
       "     <path d=\"M 502.496875 23.798437 \n",
       "L 522.496875 23.798437 \n",
       "L 522.496875 16.798437 \n",
       "L 502.496875 16.798437 \n",
       "z\n",
       "\" style=\"fill: #4c72b0\"/>\n",
       "    </g>\n",
       "    <g id=\"text_14\">\n",
       "     <!-- frequency -->\n",
       "     <g style=\"fill: #262626\" transform=\"translate(530.496875 23.798437) scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSerif-66\" d=\"M 2753 4078 \n",
       "L 2450 4078 \n",
       "Q 2447 4313 2317 4434 \n",
       "Q 2188 4556 1941 4556 \n",
       "Q 1619 4556 1487 4379 \n",
       "Q 1356 4203 1356 3750 \n",
       "L 1356 3322 \n",
       "L 2284 3322 \n",
       "L 2284 2988 \n",
       "L 1356 2988 \n",
       "L 1356 331 \n",
       "L 2094 331 \n",
       "L 2094 0 \n",
       "L 231 0 \n",
       "L 231 331 \n",
       "L 781 331 \n",
       "L 781 2988 \n",
       "L 231 2988 \n",
       "L 231 3322 \n",
       "L 781 3322 \n",
       "L 781 3738 \n",
       "Q 781 4294 1070 4578 \n",
       "Q 1359 4863 1919 4863 \n",
       "Q 2128 4863 2337 4825 \n",
       "Q 2547 4788 2753 4709 \n",
       "L 2753 4078 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-72\" d=\"M 3059 3328 \n",
       "L 3059 2497 \n",
       "L 2728 2497 \n",
       "Q 2713 2744 2591 2866 \n",
       "Q 2469 2988 2234 2988 \n",
       "Q 1809 2988 1582 2694 \n",
       "Q 1356 2400 1356 1850 \n",
       "L 1356 331 \n",
       "L 2022 331 \n",
       "L 2022 0 \n",
       "L 263 0 \n",
       "L 263 331 \n",
       "L 781 331 \n",
       "L 781 2994 \n",
       "L 231 2994 \n",
       "L 231 3322 \n",
       "L 1356 3322 \n",
       "L 1356 2731 \n",
       "Q 1525 3078 1790 3245 \n",
       "Q 2056 3413 2438 3413 \n",
       "Q 2578 3413 2733 3391 \n",
       "Q 2888 3369 3059 3328 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-65\" d=\"M 3469 1600 \n",
       "L 991 1600 \n",
       "L 991 1575 \n",
       "Q 991 903 1244 561 \n",
       "Q 1497 219 1991 219 \n",
       "Q 2369 219 2611 417 \n",
       "Q 2853 616 2950 1006 \n",
       "L 3413 1006 \n",
       "Q 3275 459 2904 184 \n",
       "Q 2534 -91 1931 -91 \n",
       "Q 1203 -91 761 389 \n",
       "Q 319 869 319 1663 \n",
       "Q 319 2450 753 2931 \n",
       "Q 1188 3413 1894 3413 \n",
       "Q 2647 3413 3050 2948 \n",
       "Q 3453 2484 3469 1600 \n",
       "z\n",
       "M 2791 1931 \n",
       "Q 2772 2513 2545 2808 \n",
       "Q 2319 3103 1894 3103 \n",
       "Q 1497 3103 1269 2806 \n",
       "Q 1041 2509 991 1931 \n",
       "L 2791 1931 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-71\" d=\"M 3359 2988 \n",
       "L 3359 -997 \n",
       "L 3909 -997 \n",
       "L 3909 -1331 \n",
       "L 2241 -1331 \n",
       "L 2241 -997 \n",
       "L 2784 -997 \n",
       "L 2784 519 \n",
       "Q 2616 206 2355 57 \n",
       "Q 2094 -91 1709 -91 \n",
       "Q 1097 -91 708 395 \n",
       "Q 319 881 319 1663 \n",
       "Q 319 2444 706 2928 \n",
       "Q 1094 3413 1709 3413 \n",
       "Q 2094 3413 2355 3264 \n",
       "Q 2616 3116 2784 2803 \n",
       "L 2784 3322 \n",
       "L 3909 3322 \n",
       "L 3909 2988 \n",
       "L 3359 2988 \n",
       "z\n",
       "M 2784 1825 \n",
       "Q 2784 2422 2554 2737 \n",
       "Q 2325 3053 1888 3053 \n",
       "Q 1444 3053 1217 2703 \n",
       "Q 991 2353 991 1663 \n",
       "Q 991 975 1217 622 \n",
       "Q 1444 269 1888 269 \n",
       "Q 2325 269 2554 583 \n",
       "Q 2784 897 2784 1497 \n",
       "L 2784 1825 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-75\" d=\"M 2266 3322 \n",
       "L 3341 3322 \n",
       "L 3341 331 \n",
       "L 3884 331 \n",
       "L 3884 0 \n",
       "L 2766 0 \n",
       "L 2766 588 \n",
       "Q 2606 256 2353 82 \n",
       "Q 2100 -91 1766 -91 \n",
       "Q 1213 -91 952 223 \n",
       "Q 691 538 691 1209 \n",
       "L 691 2988 \n",
       "L 172 2988 \n",
       "L 172 3322 \n",
       "L 1269 3322 \n",
       "L 1269 1388 \n",
       "Q 1269 781 1417 556 \n",
       "Q 1566 331 1947 331 \n",
       "Q 2347 331 2556 625 \n",
       "Q 2766 919 2766 1478 \n",
       "L 2766 2988 \n",
       "L 2266 2988 \n",
       "L 2266 3322 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-6e\" d=\"M 263 0 \n",
       "L 263 331 \n",
       "L 781 331 \n",
       "L 781 2988 \n",
       "L 231 2988 \n",
       "L 231 3322 \n",
       "L 1356 3322 \n",
       "L 1356 2731 \n",
       "Q 1516 3069 1770 3241 \n",
       "Q 2025 3413 2363 3413 \n",
       "Q 2913 3413 3172 3097 \n",
       "Q 3431 2781 3431 2113 \n",
       "L 3431 331 \n",
       "L 3944 331 \n",
       "L 3944 0 \n",
       "L 2356 0 \n",
       "L 2356 331 \n",
       "L 2853 331 \n",
       "L 2853 1931 \n",
       "Q 2853 2541 2703 2767 \n",
       "Q 2553 2994 2175 2994 \n",
       "Q 1775 2994 1565 2701 \n",
       "Q 1356 2409 1356 1850 \n",
       "L 1356 331 \n",
       "L 1856 331 \n",
       "L 1856 0 \n",
       "L 263 0 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-63\" d=\"M 3291 997 \n",
       "Q 3169 466 2822 187 \n",
       "Q 2475 -91 1925 -91 \n",
       "Q 1200 -91 759 389 \n",
       "Q 319 869 319 1663 \n",
       "Q 319 2459 759 2936 \n",
       "Q 1200 3413 1925 3413 \n",
       "Q 2241 3413 2553 3339 \n",
       "Q 2866 3266 3181 3116 \n",
       "L 3181 2266 \n",
       "L 2847 2266 \n",
       "Q 2781 2703 2561 2903 \n",
       "Q 2341 3103 1931 3103 \n",
       "Q 1466 3103 1228 2742 \n",
       "Q 991 2381 991 1663 \n",
       "Q 991 944 1227 581 \n",
       "Q 1463 219 1931 219 \n",
       "Q 2303 219 2525 412 \n",
       "Q 2747 606 2828 997 \n",
       "L 3291 997 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-79\" d=\"M 1381 -609 \n",
       "L 1600 -56 \n",
       "L 359 2988 \n",
       "L -19 2988 \n",
       "L -19 3322 \n",
       "L 1509 3322 \n",
       "L 1509 2988 \n",
       "L 978 2988 \n",
       "L 1913 703 \n",
       "L 2847 2988 \n",
       "L 2350 2988 \n",
       "L 2350 3322 \n",
       "L 3597 3322 \n",
       "L 3597 2988 \n",
       "L 3225 2988 \n",
       "L 1703 -750 \n",
       "Q 1547 -1138 1356 -1280 \n",
       "Q 1166 -1422 819 -1422 \n",
       "Q 672 -1422 517 -1397 \n",
       "Q 363 -1372 206 -1325 \n",
       "L 206 -691 \n",
       "L 500 -691 \n",
       "Q 519 -903 608 -995 \n",
       "Q 697 -1088 884 -1088 \n",
       "Q 1056 -1088 1161 -992 \n",
       "Q 1266 -897 1381 -609 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSerif-66\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-72\" x=\"37.011719\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-65\" x=\"84.814453\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-71\" x=\"143.994141\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-75\" x=\"208.007812\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-65\" x=\"272.412109\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-6e\" x=\"331.591797\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-63\" x=\"395.996094\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-79\" x=\"452.001953\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"line2d_28\">\n",
       "     <path d=\"M 502.496875 35.11875 \n",
       "L 512.496875 35.11875 \n",
       "L 522.496875 35.11875 \n",
       "\" style=\"fill: none; stroke: #ff0000; stroke-width: 1.75; stroke-linecap: round\"/>\n",
       "    </g>\n",
       "    <g id=\"text_15\">\n",
       "     <!-- mean value -->\n",
       "     <g style=\"fill: #262626\" transform=\"translate(530.496875 38.61875) scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSerif-6d\" d=\"M 3316 2675 \n",
       "Q 3481 3041 3739 3227 \n",
       "Q 3997 3413 4341 3413 \n",
       "Q 4863 3413 5119 3089 \n",
       "Q 5375 2766 5375 2113 \n",
       "L 5375 331 \n",
       "L 5894 331 \n",
       "L 5894 0 \n",
       "L 4300 0 \n",
       "L 4300 331 \n",
       "L 4800 331 \n",
       "L 4800 2047 \n",
       "Q 4800 2556 4650 2772 \n",
       "Q 4500 2988 4153 2988 \n",
       "Q 3769 2988 3567 2697 \n",
       "Q 3366 2406 3366 1850 \n",
       "L 3366 331 \n",
       "L 3866 331 \n",
       "L 3866 0 \n",
       "L 2291 0 \n",
       "L 2291 331 \n",
       "L 2791 331 \n",
       "L 2791 2069 \n",
       "Q 2791 2566 2641 2777 \n",
       "Q 2491 2988 2144 2988 \n",
       "Q 1759 2988 1557 2697 \n",
       "Q 1356 2406 1356 1850 \n",
       "L 1356 331 \n",
       "L 1856 331 \n",
       "L 1856 0 \n",
       "L 263 0 \n",
       "L 263 331 \n",
       "L 781 331 \n",
       "L 781 2994 \n",
       "L 231 2994 \n",
       "L 231 3322 \n",
       "L 1356 3322 \n",
       "L 1356 2731 \n",
       "Q 1516 3063 1762 3238 \n",
       "Q 2009 3413 2322 3413 \n",
       "Q 2709 3413 2968 3220 \n",
       "Q 3228 3028 3316 2675 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-61\" d=\"M 2547 1044 \n",
       "L 2547 1747 \n",
       "L 1806 1747 \n",
       "Q 1378 1747 1168 1562 \n",
       "Q 959 1378 959 997 \n",
       "Q 959 650 1171 447 \n",
       "Q 1384 244 1747 244 \n",
       "Q 2106 244 2326 466 \n",
       "Q 2547 688 2547 1044 \n",
       "z\n",
       "M 3122 2075 \n",
       "L 3122 331 \n",
       "L 3634 331 \n",
       "L 3634 0 \n",
       "L 2547 0 \n",
       "L 2547 359 \n",
       "Q 2356 128 2106 18 \n",
       "Q 1856 -91 1522 -91 \n",
       "Q 969 -91 644 203 \n",
       "Q 319 497 319 997 \n",
       "Q 319 1513 691 1797 \n",
       "Q 1063 2081 1741 2081 \n",
       "L 2547 2081 \n",
       "L 2547 2309 \n",
       "Q 2547 2688 2317 2895 \n",
       "Q 2088 3103 1672 3103 \n",
       "Q 1328 3103 1125 2947 \n",
       "Q 922 2791 872 2484 \n",
       "L 575 2484 \n",
       "L 575 3156 \n",
       "Q 875 3284 1158 3348 \n",
       "Q 1441 3413 1709 3413 \n",
       "Q 2400 3413 2761 3070 \n",
       "Q 3122 2728 3122 2075 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-20\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-76\" d=\"M 1581 0 \n",
       "L 359 2988 \n",
       "L -19 2988 \n",
       "L -19 3322 \n",
       "L 1509 3322 \n",
       "L 1509 2988 \n",
       "L 978 2988 \n",
       "L 1913 703 \n",
       "L 2847 2988 \n",
       "L 2350 2988 \n",
       "L 2350 3322 \n",
       "L 3597 3322 \n",
       "L 3597 2988 \n",
       "L 3225 2988 \n",
       "L 2003 0 \n",
       "L 1581 0 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-6c\" d=\"M 1313 331 \n",
       "L 1856 331 \n",
       "L 1856 0 \n",
       "L 184 0 \n",
       "L 184 331 \n",
       "L 738 331 \n",
       "L 738 4531 \n",
       "L 184 4531 \n",
       "L 184 4863 \n",
       "L 1313 4863 \n",
       "L 1313 331 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSerif-6d\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-65\" x=\"94.824219\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-61\" x=\"154.003906\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-6e\" x=\"213.623047\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-20\" x=\"278.027344\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-76\" x=\"309.814453\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-61\" x=\"366.308594\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-6c\" x=\"425.927734\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-75\" x=\"457.910156\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-65\" x=\"522.314453\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p35c8b023fb\">\n",
       "   <rect x=\"39.65\" y=\"7.2\" width=\"558\" height=\"332.64\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 1000x600 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(10, 6))\n",
    "plt.hist(S[-1], bins=35, label='frequency')\n",
    "plt.axvline(S[-1].mean(), color='r', label='mean value')\n",
    "plt.legend(loc=0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### NumPy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 130,
   "metadata": {},
   "outputs": [],
   "source": [
    "def mcs_simulation_np(p):\n",
    "    M, I = p\n",
    "    dt = T / M\n",
    "    S = np.zeros((M + 1, I))\n",
    "    S[0] = S0\n",
    "    rn = np.random.standard_normal(S.shape)\n",
    "    for t in range(1, M + 1):  \n",
    "        S[t] = S[t-1] * np.exp((r - sigma ** 2 / 2) * dt +\n",
    "                               sigma * math.sqrt(dt) * rn[t]) \n",
    "    return S      "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 131,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 108 ms, sys: 13.8 ms, total: 122 ms\n",
      "Wall time: 125 ms\n"
     ]
    }
   ],
   "source": [
    "%time S = mcs_simulation_np((M, I))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 132,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "38.157311718296555"
      ]
     },
     "execution_count": 132,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "S[-1].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 133,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "109 ms ± 513 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
     ]
    }
   ],
   "source": [
    "%timeit S = mcs_simulation_np((M, I))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Numba "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 134,
   "metadata": {},
   "outputs": [],
   "source": [
    "mcs_simulation_nb = numba.jit(mcs_simulation_py)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 135,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 317 ms, sys: 12 ms, total: 329 ms\n",
      "Wall time: 328 ms\n"
     ]
    }
   ],
   "source": [
    "%time S = mcs_simulation_nb((M, I))  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 136,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 111 ms, sys: 6.21 ms, total: 117 ms\n",
      "Wall time: 117 ms\n"
     ]
    }
   ],
   "source": [
    "%time S = mcs_simulation_nb((M, I))  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 137,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "38.25844889642977"
      ]
     },
     "execution_count": 137,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "S[-1].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 138,
   "metadata": {},
   "outputs": [],
   "source": [
    "C0 = math.exp(-r * T) * np.maximum(K - S[-1], 0).mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 139,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3.839565952569393"
      ]
     },
     "execution_count": 139,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "C0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 140,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "114 ms ± 222 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
     ]
    }
   ],
   "source": [
    "%timeit S = mcs_simulation_nb((M, I))  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Cython &mdash; Sequential"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 141,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%cython\n",
    "import numpy as np\n",
    "cimport numpy as np\n",
    "cimport cython\n",
    "from libc.math cimport exp, sqrt\n",
    "cdef float S0 = 36.\n",
    "cdef float T = 1.0\n",
    "cdef float r = 0.06\n",
    "cdef float sigma = 0.2\n",
    "@cython.boundscheck(False)\n",
    "@cython.wraparound(False)\n",
    "def mcs_simulation_cy(p):\n",
    "    cdef int M, I\n",
    "    M, I = p\n",
    "    cdef int t, i\n",
    "    cdef float dt = T / M\n",
    "    cdef double[:, :] S = np.zeros((M + 1, I))\n",
    "    cdef double[:, :] rn = np.random.standard_normal((M + 1, I))\n",
    "    S[0] = S0\n",
    "    for t in range(1, M + 1):\n",
    "        for i in range(I):\n",
    "            S[t, i] = S[t-1, i] * exp((r - sigma ** 2 / 2) * dt +\n",
    "                                         sigma * sqrt(dt) * rn[t, i])\n",
    "    return np.array(S) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 142,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 109 ms, sys: 10.9 ms, total: 120 ms\n",
      "Wall time: 118 ms\n"
     ]
    }
   ],
   "source": [
    "%time S = mcs_simulation_cy((M, I))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 143,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "38.235224280263466"
      ]
     },
     "execution_count": 143,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "S[-1].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 144,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "115 ms ± 415 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
     ]
    }
   ],
   "source": [
    "%timeit S = mcs_simulation_cy((M, I))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Multiprocessing"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 145,
   "metadata": {},
   "outputs": [],
   "source": [
    "import multiprocessing as mp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 146,
   "metadata": {},
   "outputs": [],
   "source": [
    "pool = mp.Pool(processes=4)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 147,
   "metadata": {},
   "outputs": [],
   "source": [
    "p = 20  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<b style=\"color: red;\">This currently does not work on Macs with Apple Silicon.</b>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 148,
   "metadata": {},
   "outputs": [],
   "source": [
    "# %timeit S = np.hstack(pool.map(mcs_simulation_np, p * [(M, int(I / p))]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 149,
   "metadata": {},
   "outputs": [],
   "source": [
    "# %timeit S = np.hstack(pool.map(mcs_simulation_nb, p * [(M, int(I / p))]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 150,
   "metadata": {},
   "outputs": [],
   "source": [
    "# %timeit S = np.hstack(pool.map(mcs_simulation_cy, p * [(M, int(I / p))]))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Recursive pandas Algorithm"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Data and Formula"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 151,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numba\n",
    "import numpy as np\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 152,
   "metadata": {},
   "outputs": [],
   "source": [
    "sym = 'SPY'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 153,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.DataFrame(pd.read_csv('http://hilpisch.com/tr_eikon_eod_data.csv',\n",
    "                               index_col=0, parse_dates=True)[sym]).dropna()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 154,
   "metadata": {},
   "outputs": [],
   "source": [
    "alpha = 0.25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 155,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['EWMA'] = data[sym]  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 156,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 139 ms, sys: 2.66 ms, total: 141 ms\n",
      "Wall time: 141 ms\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "for t in zip(data.index, data.index[1:]):\n",
    "    data.loc[t[1], 'EWMA'] = (alpha * data.loc[t[1], sym] +\n",
    "                              (1 - alpha) * data.loc[t[0], 'EWMA'])  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 157,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>SPY</th>\n",
       "      <th>EWMA</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2010-01-04</th>\n",
       "      <td>113.33</td>\n",
       "      <td>113.330000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2010-01-05</th>\n",
       "      <td>113.63</td>\n",
       "      <td>113.405000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2010-01-06</th>\n",
       "      <td>113.71</td>\n",
       "      <td>113.481250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2010-01-07</th>\n",
       "      <td>114.19</td>\n",
       "      <td>113.658438</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2010-01-08</th>\n",
       "      <td>114.57</td>\n",
       "      <td>113.886328</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               SPY        EWMA\n",
       "Date                          \n",
       "2010-01-04  113.33  113.330000\n",
       "2010-01-05  113.63  113.405000\n",
       "2010-01-06  113.71  113.481250\n",
       "2010-01-07  114.19  113.658438\n",
       "2010-01-08  114.57  113.886328"
      ]
     },
     "execution_count": 157,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 158,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"598.4875pt\" height=\"358.964783pt\" viewBox=\"0 0 598.4875 358.964783\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2023-10-15T07:43:39.121635</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.8.0, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 358.964783 \n",
       "L 598.4875 358.964783 \n",
       "L 598.4875 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 33.2875 300.96 \n",
       "L 591.2875 300.96 \n",
       "L 591.2875 7.2 \n",
       "L 33.2875 7.2 \n",
       "z\n",
       "\" style=\"fill: #eaeaf2\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <path d=\"M 56.779281 300.96 \n",
       "L 56.779281 7.2 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_2\"/>\n",
       "     <g id=\"text_1\">\n",
       "      <!-- 2017-01 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(19.752023 335.317784) rotate(-30) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-32\" d=\"M 819 3553 \n",
       "L 469 3553 \n",
       "L 469 4384 \n",
       "Q 803 4563 1142 4656 \n",
       "Q 1481 4750 1806 4750 \n",
       "Q 2534 4750 2956 4397 \n",
       "Q 3378 4044 3378 3438 \n",
       "Q 3378 2753 2422 1800 \n",
       "Q 2347 1728 2309 1691 \n",
       "L 1131 513 \n",
       "L 3078 513 \n",
       "L 3078 1088 \n",
       "L 3444 1088 \n",
       "L 3444 0 \n",
       "L 434 0 \n",
       "L 434 341 \n",
       "L 1850 1753 \n",
       "Q 2319 2222 2519 2614 \n",
       "Q 2719 3006 2719 3438 \n",
       "Q 2719 3909 2473 4175 \n",
       "Q 2228 4441 1797 4441 \n",
       "Q 1350 4441 1106 4219 \n",
       "Q 863 3997 819 3553 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSerif-30\" d=\"M 2034 219 \n",
       "Q 2513 219 2750 744 \n",
       "Q 2988 1269 2988 2328 \n",
       "Q 2988 3391 2750 3916 \n",
       "Q 2513 4441 2034 4441 \n",
       "Q 1556 4441 1318 3916 \n",
       "Q 1081 3391 1081 2328 \n",
       "Q 1081 1269 1318 744 \n",
       "Q 1556 219 2034 219 \n",
       "z\n",
       "M 2034 -91 \n",
       "Q 1275 -91 848 546 \n",
       "Q 422 1184 422 2328 \n",
       "Q 422 3475 848 4112 \n",
       "Q 1275 4750 2034 4750 \n",
       "Q 2797 4750 3222 4112 \n",
       "Q 3647 3475 3647 2328 \n",
       "Q 3647 1184 3222 546 \n",
       "Q 2797 -91 2034 -91 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSerif-31\" d=\"M 909 0 \n",
       "L 909 331 \n",
       "L 1722 331 \n",
       "L 1722 4213 \n",
       "L 781 3603 \n",
       "L 781 4013 \n",
       "L 1919 4750 \n",
       "L 2350 4750 \n",
       "L 2350 331 \n",
       "L 3163 331 \n",
       "L 3163 0 \n",
       "L 909 0 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSerif-37\" d=\"M 3609 4347 \n",
       "L 1784 0 \n",
       "L 1319 0 \n",
       "L 3059 4153 \n",
       "L 903 4153 \n",
       "L 903 3578 \n",
       "L 538 3578 \n",
       "L 538 4666 \n",
       "L 3609 4666 \n",
       "L 3609 4347 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSerif-2d\" d=\"M 281 1959 \n",
       "L 1881 1959 \n",
       "L 1881 1472 \n",
       "L 281 1472 \n",
       "L 281 1959 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\" x=\"127.246094\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-37\" x=\"190.869141\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2d\" x=\"254.492188\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"288.28125\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\" x=\"351.904297\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <path d=\"M 111.999006 300.96 \n",
       "L 111.999006 7.2 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_4\"/>\n",
       "     <g id=\"text_2\">\n",
       "      <!-- 2017-03 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(74.971747 335.317784) rotate(-30) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-33\" d=\"M 622 4469 \n",
       "Q 988 4606 1323 4678 \n",
       "Q 1659 4750 1953 4750 \n",
       "Q 2638 4750 3022 4454 \n",
       "Q 3406 4159 3406 3634 \n",
       "Q 3406 3213 3140 2930 \n",
       "Q 2875 2647 2388 2547 \n",
       "Q 2963 2466 3280 2130 \n",
       "Q 3597 1794 3597 1259 \n",
       "Q 3597 606 3158 257 \n",
       "Q 2719 -91 1894 -91 \n",
       "Q 1528 -91 1179 -12 \n",
       "Q 831 66 488 225 \n",
       "L 488 1131 \n",
       "L 838 1131 \n",
       "Q 869 681 1141 450 \n",
       "Q 1413 219 1906 219 \n",
       "Q 2384 219 2661 495 \n",
       "Q 2938 772 2938 1253 \n",
       "Q 2938 1803 2653 2086 \n",
       "Q 2369 2369 1819 2369 \n",
       "L 1522 2369 \n",
       "L 1522 2688 \n",
       "L 1678 2688 \n",
       "Q 2225 2688 2498 2914 \n",
       "Q 2772 3141 2772 3597 \n",
       "Q 2772 4006 2547 4223 \n",
       "Q 2322 4441 1900 4441 \n",
       "Q 1478 4441 1245 4241 \n",
       "Q 1013 4041 972 3647 \n",
       "L 622 3647 \n",
       "L 622 4469 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\" x=\"127.246094\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-37\" x=\"190.869141\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2d\" x=\"254.492188\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"288.28125\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-33\" x=\"351.904297\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <path d=\"M 169.090586 300.96 \n",
       "L 169.090586 7.2 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_6\"/>\n",
       "     <g id=\"text_3\">\n",
       "      <!-- 2017-05 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(132.063327 335.317784) rotate(-30) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-35\" d=\"M 3219 4666 \n",
       "L 3219 4153 \n",
       "L 1081 4153 \n",
       "L 1081 2816 \n",
       "Q 1244 2928 1461 2984 \n",
       "Q 1678 3041 1947 3041 \n",
       "Q 2703 3041 3140 2622 \n",
       "Q 3578 2203 3578 1478 \n",
       "Q 3578 738 3136 323 \n",
       "Q 2694 -91 1894 -91 \n",
       "Q 1572 -91 1234 -12 \n",
       "Q 897 66 544 225 \n",
       "L 544 1131 \n",
       "L 897 1131 \n",
       "Q 925 688 1179 453 \n",
       "Q 1434 219 1894 219 \n",
       "Q 2388 219 2653 544 \n",
       "Q 2919 869 2919 1478 \n",
       "Q 2919 2084 2655 2407 \n",
       "Q 2391 2731 1894 2731 \n",
       "Q 1613 2731 1398 2631 \n",
       "Q 1184 2531 1019 2322 \n",
       "L 750 2322 \n",
       "L 750 4666 \n",
       "L 3219 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\" x=\"127.246094\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-37\" x=\"190.869141\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2d\" x=\"254.492188\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"288.28125\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-35\" x=\"351.904297\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <path d=\"M 226.182166 300.96 \n",
       "L 226.182166 7.2 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_8\"/>\n",
       "     <g id=\"text_4\">\n",
       "      <!-- 2017-07 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(189.154907 335.317784) rotate(-30) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\" x=\"127.246094\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-37\" x=\"190.869141\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2d\" x=\"254.492188\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"288.28125\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-37\" x=\"351.904297\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <path d=\"M 284.209674 300.96 \n",
       "L 284.209674 7.2 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_10\"/>\n",
       "     <g id=\"text_5\">\n",
       "      <!-- 2017-09 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(247.182415 335.317784) rotate(-30) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-39\" d=\"M 2994 2091 \n",
       "Q 2784 1856 2512 1740 \n",
       "Q 2241 1625 1900 1625 \n",
       "Q 1206 1625 804 2044 \n",
       "Q 403 2463 403 3188 \n",
       "Q 403 3897 839 4323 \n",
       "Q 1275 4750 2003 4750 \n",
       "Q 2794 4750 3217 4161 \n",
       "Q 3641 3572 3641 2478 \n",
       "Q 3641 1253 3137 581 \n",
       "Q 2634 -91 1722 -91 \n",
       "Q 1475 -91 1203 -44 \n",
       "Q 931 3 647 97 \n",
       "L 647 872 \n",
       "L 997 872 \n",
       "Q 1038 556 1241 387 \n",
       "Q 1444 219 1784 219 \n",
       "Q 2391 219 2687 676 \n",
       "Q 2984 1134 2994 2091 \n",
       "z\n",
       "M 1978 4441 \n",
       "Q 1534 4441 1298 4117 \n",
       "Q 1063 3794 1063 3188 \n",
       "Q 1063 2581 1298 2256 \n",
       "Q 1534 1931 1978 1931 \n",
       "Q 2422 1931 2658 2245 \n",
       "Q 2894 2559 2894 3150 \n",
       "Q 2894 3772 2656 4106 \n",
       "Q 2419 4441 1978 4441 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\" x=\"127.246094\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-37\" x=\"190.869141\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2d\" x=\"254.492188\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"288.28125\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-39\" x=\"351.904297\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_6\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <path d=\"M 341.301254 300.96 \n",
       "L 341.301254 7.2 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_12\"/>\n",
       "     <g id=\"text_6\">\n",
       "      <!-- 2017-11 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(304.273995 335.317784) rotate(-30) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\" x=\"127.246094\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-37\" x=\"190.869141\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2d\" x=\"254.492188\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\" x=\"288.28125\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\" x=\"351.904297\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_7\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <path d=\"M 398.392834 300.96 \n",
       "L 398.392834 7.2 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_14\"/>\n",
       "     <g id=\"text_7\">\n",
       "      <!-- 2018-01 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(361.365575 335.317784) rotate(-30) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-38\" d=\"M 2981 1275 \n",
       "Q 2981 1775 2732 2051 \n",
       "Q 2484 2328 2034 2328 \n",
       "Q 1584 2328 1336 2051 \n",
       "Q 1088 1775 1088 1275 \n",
       "Q 1088 772 1336 495 \n",
       "Q 1584 219 2034 219 \n",
       "Q 2484 219 2732 495 \n",
       "Q 2981 772 2981 1275 \n",
       "z\n",
       "M 2853 3541 \n",
       "Q 2853 3966 2637 4203 \n",
       "Q 2422 4441 2034 4441 \n",
       "Q 1650 4441 1433 4203 \n",
       "Q 1216 3966 1216 3541 \n",
       "Q 1216 3113 1433 2875 \n",
       "Q 1650 2638 2034 2638 \n",
       "Q 2422 2638 2637 2875 \n",
       "Q 2853 3113 2853 3541 \n",
       "z\n",
       "M 2516 2484 \n",
       "Q 3047 2413 3344 2092 \n",
       "Q 3641 1772 3641 1275 \n",
       "Q 3641 619 3225 264 \n",
       "Q 2809 -91 2034 -91 \n",
       "Q 1263 -91 845 264 \n",
       "Q 428 619 428 1275 \n",
       "Q 428 1772 725 2092 \n",
       "Q 1022 2413 1556 2484 \n",
       "Q 1084 2569 832 2842 \n",
       "Q 581 3116 581 3541 \n",
       "Q 581 4103 968 4426 \n",
       "Q 1356 4750 2034 4750 \n",
       "Q 2713 4750 3100 4426 \n",
       "Q 3488 4103 3488 3541 \n",
       "Q 3488 3116 3236 2842 \n",
       "Q 2984 2569 2516 2484 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\" x=\"127.246094\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-38\" x=\"190.869141\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2d\" x=\"254.492188\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"288.28125\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\" x=\"351.904297\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_8\">\n",
       "     <g id=\"line2d_15\">\n",
       "      <path d=\"M 453.612559 300.96 \n",
       "L 453.612559 7.2 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_16\"/>\n",
       "     <g id=\"text_8\">\n",
       "      <!-- 2018-03 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(416.5853 335.317784) rotate(-30) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\" x=\"127.246094\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-38\" x=\"190.869141\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2d\" x=\"254.492188\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"288.28125\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-33\" x=\"351.904297\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_9\">\n",
       "     <g id=\"line2d_17\">\n",
       "      <path d=\"M 510.704139 300.96 \n",
       "L 510.704139 7.2 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_18\"/>\n",
       "     <g id=\"text_9\">\n",
       "      <!-- 2018-05 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(473.67688 335.317784) rotate(-30) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\" x=\"127.246094\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-38\" x=\"190.869141\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2d\" x=\"254.492188\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"288.28125\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-35\" x=\"351.904297\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_10\">\n",
       "     <g id=\"line2d_19\">\n",
       "      <path d=\"M 567.795719 300.96 \n",
       "L 567.795719 7.2 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_20\"/>\n",
       "     <g id=\"text_10\">\n",
       "      <!-- 2018-07 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(530.76846 335.317784) rotate(-30) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-31\" x=\"127.246094\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-38\" x=\"190.869141\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-2d\" x=\"254.492188\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"288.28125\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-37\" x=\"351.904297\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_11\">\n",
       "     <!-- Date -->\n",
       "     <g style=\"fill: #262626\" transform=\"translate(299.133047 349.477127) scale(0.11 -0.11)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSerif-44\" d=\"M 1581 331 \n",
       "L 2163 331 \n",
       "Q 3072 331 3558 850 \n",
       "Q 4044 1369 4044 2338 \n",
       "Q 4044 3306 3559 3818 \n",
       "Q 3075 4331 2163 4331 \n",
       "L 1581 4331 \n",
       "L 1581 331 \n",
       "z\n",
       "M 353 0 \n",
       "L 353 331 \n",
       "L 947 331 \n",
       "L 947 4331 \n",
       "L 353 4331 \n",
       "L 353 4666 \n",
       "L 2209 4666 \n",
       "Q 3416 4666 4089 4050 \n",
       "Q 4763 3434 4763 2338 \n",
       "Q 4763 1238 4088 619 \n",
       "Q 3413 0 2209 0 \n",
       "L 353 0 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-61\" d=\"M 2547 1044 \n",
       "L 2547 1747 \n",
       "L 1806 1747 \n",
       "Q 1378 1747 1168 1562 \n",
       "Q 959 1378 959 997 \n",
       "Q 959 650 1171 447 \n",
       "Q 1384 244 1747 244 \n",
       "Q 2106 244 2326 466 \n",
       "Q 2547 688 2547 1044 \n",
       "z\n",
       "M 3122 2075 \n",
       "L 3122 331 \n",
       "L 3634 331 \n",
       "L 3634 0 \n",
       "L 2547 0 \n",
       "L 2547 359 \n",
       "Q 2356 128 2106 18 \n",
       "Q 1856 -91 1522 -91 \n",
       "Q 969 -91 644 203 \n",
       "Q 319 497 319 997 \n",
       "Q 319 1513 691 1797 \n",
       "Q 1063 2081 1741 2081 \n",
       "L 2547 2081 \n",
       "L 2547 2309 \n",
       "Q 2547 2688 2317 2895 \n",
       "Q 2088 3103 1672 3103 \n",
       "Q 1328 3103 1125 2947 \n",
       "Q 922 2791 872 2484 \n",
       "L 575 2484 \n",
       "L 575 3156 \n",
       "Q 875 3284 1158 3348 \n",
       "Q 1441 3413 1709 3413 \n",
       "Q 2400 3413 2761 3070 \n",
       "Q 3122 2728 3122 2075 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-74\" d=\"M 691 2988 \n",
       "L 184 2988 \n",
       "L 184 3322 \n",
       "L 691 3322 \n",
       "L 691 4353 \n",
       "L 1269 4353 \n",
       "L 1269 3322 \n",
       "L 2350 3322 \n",
       "L 2350 2988 \n",
       "L 1269 2988 \n",
       "L 1269 878 \n",
       "Q 1269 456 1350 337 \n",
       "Q 1431 219 1650 219 \n",
       "Q 1875 219 1978 351 \n",
       "Q 2081 484 2088 781 \n",
       "L 2522 781 \n",
       "Q 2497 328 2275 118 \n",
       "Q 2053 -91 1600 -91 \n",
       "Q 1103 -91 897 129 \n",
       "Q 691 350 691 878 \n",
       "L 691 2988 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-65\" d=\"M 3469 1600 \n",
       "L 991 1600 \n",
       "L 991 1575 \n",
       "Q 991 903 1244 561 \n",
       "Q 1497 219 1991 219 \n",
       "Q 2369 219 2611 417 \n",
       "Q 2853 616 2950 1006 \n",
       "L 3413 1006 \n",
       "Q 3275 459 2904 184 \n",
       "Q 2534 -91 1931 -91 \n",
       "Q 1203 -91 761 389 \n",
       "Q 319 869 319 1663 \n",
       "Q 319 2450 753 2931 \n",
       "Q 1188 3413 1894 3413 \n",
       "Q 2647 3413 3050 2948 \n",
       "Q 3453 2484 3469 1600 \n",
       "z\n",
       "M 2791 1931 \n",
       "Q 2772 2513 2545 2808 \n",
       "Q 2319 3103 1894 3103 \n",
       "Q 1497 3103 1269 2806 \n",
       "Q 1041 2509 991 1931 \n",
       "L 2791 1931 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSerif-44\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-61\" x=\"80.175781\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-74\" x=\"139.794922\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-65\" x=\"179.980469\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_21\">\n",
       "      <path d=\"M 33.2875 265.479542 \n",
       "L 591.2875 265.479542 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_22\"/>\n",
       "     <g id=\"text_12\">\n",
       "      <!-- 230 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(7.2 269.278761) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-33\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"127.246094\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_23\">\n",
       "      <path d=\"M 33.2875 222.190957 \n",
       "L 591.2875 222.190957 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_24\"/>\n",
       "     <g id=\"text_13\">\n",
       "      <!-- 240 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(7.2 225.990176) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-34\" d=\"M 2234 1581 \n",
       "L 2234 4063 \n",
       "L 641 1581 \n",
       "L 2234 1581 \n",
       "z\n",
       "M 3609 0 \n",
       "L 1484 0 \n",
       "L 1484 331 \n",
       "L 2234 331 \n",
       "L 2234 1247 \n",
       "L 197 1247 \n",
       "L 197 1588 \n",
       "L 2241 4750 \n",
       "L 2859 4750 \n",
       "L 2859 1581 \n",
       "L 3750 1581 \n",
       "L 3750 1247 \n",
       "L 2859 1247 \n",
       "L 2859 331 \n",
       "L 3609 331 \n",
       "L 3609 0 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-34\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"127.246094\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_25\">\n",
       "      <path d=\"M 33.2875 178.902372 \n",
       "L 591.2875 178.902372 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_26\"/>\n",
       "     <g id=\"text_14\">\n",
       "      <!-- 250 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(7.2 182.701591) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-35\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"127.246094\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_27\">\n",
       "      <path d=\"M 33.2875 135.613787 \n",
       "L 591.2875 135.613787 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_28\"/>\n",
       "     <g id=\"text_15\">\n",
       "      <!-- 260 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(7.2 139.413005) scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSerif-36\" d=\"M 2094 219 \n",
       "Q 2534 219 2771 542 \n",
       "Q 3009 866 3009 1472 \n",
       "Q 3009 2078 2771 2401 \n",
       "Q 2534 2725 2094 2725 \n",
       "Q 1647 2725 1412 2412 \n",
       "Q 1178 2100 1178 1509 \n",
       "Q 1178 888 1415 553 \n",
       "Q 1653 219 2094 219 \n",
       "z\n",
       "M 1075 2569 \n",
       "Q 1288 2803 1556 2918 \n",
       "Q 1825 3034 2163 3034 \n",
       "Q 2859 3034 3264 2615 \n",
       "Q 3669 2197 3669 1472 \n",
       "Q 3669 763 3233 336 \n",
       "Q 2797 -91 2069 -91 \n",
       "Q 1278 -91 853 498 \n",
       "Q 428 1088 428 2181 \n",
       "Q 428 3406 931 4078 \n",
       "Q 1434 4750 2350 4750 \n",
       "Q 2597 4750 2869 4703 \n",
       "Q 3141 4656 3425 4563 \n",
       "L 3425 3794 \n",
       "L 3072 3794 \n",
       "Q 3034 4109 2831 4275 \n",
       "Q 2628 4441 2284 4441 \n",
       "Q 1678 4441 1381 3981 \n",
       "Q 1084 3522 1075 2569 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-36\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"127.246094\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_29\">\n",
       "      <path d=\"M 33.2875 92.325202 \n",
       "L 591.2875 92.325202 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_30\"/>\n",
       "     <g id=\"text_16\">\n",
       "      <!-- 270 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(7.2 96.12442) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-37\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"127.246094\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_31\">\n",
       "      <path d=\"M 33.2875 49.036616 \n",
       "L 591.2875 49.036616 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #ffffff; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_32\"/>\n",
       "     <g id=\"text_17\">\n",
       "      <!-- 280 -->\n",
       "      <g style=\"fill: #262626\" transform=\"translate(7.2 52.835835) scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSerif-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-38\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSerif-30\" x=\"127.246094\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_33\">\n",
       "    <path d=\"M 58.651136 286.084909 \n",
       "L 59.587064 280.284238 \n",
       "L 60.522991 281.063433 \n",
       "L 61.458919 277.557058 \n",
       "L 64.266702 280.803701 \n",
       "L 65.202629 280.803701 \n",
       "L 66.138557 278.033232 \n",
       "L 67.074484 280.500681 \n",
       "L 68.010412 278.249675 \n",
       "L 71.754122 281.712762 \n",
       "L 72.690049 279.548332 \n",
       "L 73.625977 283.184574 \n",
       "L 74.561905 279.591621 \n",
       "L 77.369687 282.145648 \n",
       "L 78.305615 275.868803 \n",
       "L 79.241542 267.340951 \n",
       "L 80.17747 268.379877 \n",
       "L 81.113397 269.938267 \n",
       "L 83.92118 276.085246 \n",
       "L 84.857108 276.171823 \n",
       "L 85.793035 275.782226 \n",
       "L 86.728963 275.132897 \n",
       "L 87.66489 268.336589 \n",
       "L 90.472673 270.111421 \n",
       "L 91.4086 270.068132 \n",
       "L 92.344528 268.769475 \n",
       "L 93.280455 262.882227 \n",
       "L 94.216383 258.942966 \n",
       "L 97.024166 253.488604 \n",
       "L 97.960093 249.462766 \n",
       "L 98.896021 244.181558 \n",
       "L 99.831948 245.04733 \n",
       "L 100.767876 243.445652 \n",
       "L 104.511586 237.38525 \n",
       "L 105.447513 238.294311 \n",
       "L 106.383441 237.601693 \n",
       "L 107.319369 236.303036 \n",
       "L 110.127151 234.701358 \n",
       "L 111.063079 237.471828 \n",
       "L 111.999006 223.143306 \n",
       "L 112.934934 229.679882 \n",
       "L 113.870861 229.030554 \n",
       "L 116.678644 232.104043 \n",
       "L 117.614571 235.177533 \n",
       "L 118.550499 237.08223 \n",
       "L 119.486427 235.783573 \n",
       "L 120.422354 232.19062 \n",
       "L 123.230137 231.671157 \n",
       "L 124.166064 235.610418 \n",
       "L 125.101992 226.736259 \n",
       "L 126.037919 228.770822 \n",
       "L 126.973847 235.047667 \n",
       "L 129.781629 236.17317 \n",
       "L 130.717557 249.3329 \n",
       "L 131.653485 246.952028 \n",
       "L 132.589412 248.034242 \n",
       "L 133.52534 248.770148 \n",
       "L 136.333122 249.809074 \n",
       "L 137.26905 242.450015 \n",
       "L 138.204977 241.497666 \n",
       "L 139.140905 238.251022 \n",
       "L 140.076832 240.631894 \n",
       "L 142.884615 242.406726 \n",
       "L 143.820543 241.757398 \n",
       "L 144.75647 244.787599 \n",
       "L 145.692398 241.930552 \n",
       "L 146.628325 242.969478 \n",
       "L 149.436108 242.363438 \n",
       "L 150.372035 243.575518 \n",
       "L 151.307963 248.034242 \n",
       "L 152.24389 254.614107 \n",
       "L 155.987601 245.696659 \n",
       "L 156.923528 248.72686 \n",
       "L 157.859456 250.588269 \n",
       "L 158.795383 242.363438 \n",
       "L 159.731311 245.610082 \n",
       "L 162.539093 234.441627 \n",
       "L 163.475021 228.467802 \n",
       "L 164.410949 229.117131 \n",
       "L 165.346876 228.251359 \n",
       "L 166.282804 230.502365 \n",
       "L 169.090586 227.90505 \n",
       "L 170.026514 227.515453 \n",
       "L 170.962441 228.770822 \n",
       "L 171.898369 227.558742 \n",
       "L 172.834296 223.489615 \n",
       "L 175.642079 223.662769 \n",
       "L 176.578007 224.615118 \n",
       "L 177.513934 222.753709 \n",
       "L 178.449862 224.874849 \n",
       "L 179.385789 226.606393 \n",
       "L 182.193572 220.8923 \n",
       "L 183.129499 221.844648 \n",
       "L 184.065427 240.285586 \n",
       "L 185.001354 236.17317 \n",
       "L 185.937282 229.506728 \n",
       "L 188.745065 224.268809 \n",
       "L 190.61692 219.550353 \n",
       "L 191.552847 214.572166 \n",
       "L 197.168412 215.957401 \n",
       "L 198.10434 207.645992 \n",
       "L 199.040268 204.139617 \n",
       "L 201.84805 204.918812 \n",
       "L 202.783978 208.295321 \n",
       "L 203.719905 206.347335 \n",
       "L 204.655833 205.827872 \n",
       "L 205.59176 207.42955 \n",
       "L 208.399543 207.645992 \n",
       "L 209.33547 202.494651 \n",
       "L 210.271398 203.836597 \n",
       "L 211.207326 205.87116 \n",
       "L 212.143253 210.762771 \n",
       "L 214.951036 202.018476 \n",
       "L 215.886963 209.161093 \n",
       "L 216.822891 209.420824 \n",
       "L 217.758818 209.896999 \n",
       "L 218.694746 208.64163 \n",
       "L 221.502529 207.949013 \n",
       "L 222.438456 216.433575 \n",
       "L 223.374384 207.083241 \n",
       "L 224.310311 216.346998 \n",
       "L 225.246239 214.399012 \n",
       "L 228.054021 212.62418 \n",
       "L 229.925876 210.200019 \n",
       "L 230.861804 219.810085 \n",
       "L 231.797731 213.057066 \n",
       "L 234.605514 211.931562 \n",
       "L 235.541442 212.710757 \n",
       "L 236.477369 204.832234 \n",
       "L 237.413297 203.057402 \n",
       "L 238.349224 198.122504 \n",
       "L 241.157007 198.252369 \n",
       "L 242.092934 197.689618 \n",
       "L 243.028862 191.932236 \n",
       "L 243.96479 191.456062 \n",
       "L 244.900717 192.40841 \n",
       "L 247.7085 192.668142 \n",
       "L 248.644427 190.070827 \n",
       "L 249.580355 190.027538 \n",
       "L 250.516282 191.023176 \n",
       "L 251.45221 192.278545 \n",
       "L 254.259992 192.884585 \n",
       "L 255.19592 190.503713 \n",
       "L 256.131848 189.98425 \n",
       "L 257.067775 192.062102 \n",
       "L 258.003703 190.114115 \n",
       "L 260.811485 188.122841 \n",
       "L 261.747413 190.763444 \n",
       "L 262.68334 190.806733 \n",
       "L 263.619268 205.914449 \n",
       "L 264.555195 204.35606 \n",
       "L 267.362978 193.880222 \n",
       "L 268.298906 194.010088 \n",
       "L 269.234833 192.148679 \n",
       "L 270.170761 208.814784 \n",
       "L 271.106688 210.45975 \n",
       "L 273.914471 209.637267 \n",
       "L 274.850398 198.641967 \n",
       "L 275.786326 202.451362 \n",
       "L 276.722253 204.918812 \n",
       "L 277.658181 202.451362 \n",
       "L 280.465964 202.408074 \n",
       "L 281.401891 201.195993 \n",
       "L 282.337819 196.174517 \n",
       "L 283.273746 189.767807 \n",
       "L 284.209674 188.252706 \n",
       "L 287.953384 195.958074 \n",
       "L 288.889311 192.321833 \n",
       "L 289.825239 192.451699 \n",
       "L 290.761167 193.707068 \n",
       "L 294.504877 178.685929 \n",
       "L 295.440804 178.166466 \n",
       "L 296.376732 178.512775 \n",
       "L 297.312659 182.408747 \n",
       "L 300.120442 180.114452 \n",
       "L 301.05637 179.032238 \n",
       "L 301.992297 178.64264 \n",
       "L 302.928225 181.542976 \n",
       "L 303.864152 181.326533 \n",
       "L 306.671935 183.53425 \n",
       "L 307.607862 182.884922 \n",
       "L 308.54379 178.685929 \n",
       "L 309.479717 177.387271 \n",
       "L 310.415645 173.577876 \n",
       "L 313.223428 168.85942 \n",
       "L 314.159355 166.521837 \n",
       "L 315.095283 165.223179 \n",
       "L 316.03121 158.729891 \n",
       "L 316.967138 159.98526 \n",
       "L 319.77492 161.803381 \n",
       "L 320.710848 158.903046 \n",
       "L 321.646775 157.171502 \n",
       "L 322.582703 158.816468 \n",
       "L 323.51863 157.474522 \n",
       "L 326.326413 156.00271 \n",
       "L 327.262341 155.223516 \n",
       "L 328.198268 154.141301 \n",
       "L 329.134196 153.838281 \n",
       "L 330.070123 148.124188 \n",
       "L 332.877906 152.453046 \n",
       "L 333.813833 150.50506 \n",
       "L 334.749761 156.00271 \n",
       "L 335.685689 154.574187 \n",
       "L 336.621616 145.526873 \n",
       "L 339.429399 149.682577 \n",
       "L 340.365326 147.951033 \n",
       "L 341.301254 146.479222 \n",
       "L 342.237181 146.046336 \n",
       "L 343.173109 142.323517 \n",
       "L 345.980891 140.591974 \n",
       "L 346.916819 141.371169 \n",
       "L 347.852747 139.466471 \n",
       "L 348.788674 143.535598 \n",
       "L 349.724602 143.881906 \n",
       "L 352.532384 142.84298 \n",
       "L 353.468312 145.440296 \n",
       "L 354.404239 151.024523 \n",
       "L 355.340167 141.587611 \n",
       "L 356.276094 144.877544 \n",
       "L 359.083877 142.972846 \n",
       "L 360.019805 135.657075 \n",
       "L 360.955732 136.652713 \n",
       "L 362.827587 134.055398 \n",
       "L 365.63537 134.618149 \n",
       "L 366.571297 123.189963 \n",
       "L 367.507225 123.88258 \n",
       "L 368.443152 113.926206 \n",
       "L 369.37908 116.307078 \n",
       "L 372.186863 117.692312 \n",
       "L 373.12279 121.804728 \n",
       "L 374.058718 121.588285 \n",
       "L 374.994645 117.995333 \n",
       "L 375.930573 111.761776 \n",
       "L 378.738355 108.298689 \n",
       "L 379.674283 106.264126 \n",
       "L 380.61021 106.393992 \n",
       "L 381.546138 111.112447 \n",
       "L 382.482066 107.432918 \n",
       "L 385.289848 100.117147 \n",
       "L 386.225776 104.575871 \n",
       "L 387.161703 105.181911 \n",
       "L 388.097631 102.801039 \n",
       "L 389.033558 103.104059 \n",
       "L 392.777269 104.489294 \n",
       "L 393.713196 103.926542 \n",
       "L 394.649124 101.54567 \n",
       "L 395.585051 105.917817 \n",
       "L 399.328761 97.649697 \n",
       "L 400.264689 90.290638 \n",
       "L 401.200616 85.355739 \n",
       "L 402.136544 77.520505 \n",
       "L 404.944327 75.356076 \n",
       "L 405.880254 72.672184 \n",
       "L 406.816182 74.490304 \n",
       "L 408.688037 58.040642 \n",
       "L 412.431747 62.153058 \n",
       "L 413.367674 50.724871 \n",
       "L 414.303602 52.759435 \n",
       "L 415.23953 47.261784 \n",
       "L 418.047312 37.391987 \n",
       "L 418.98324 34.794672 \n",
       "L 419.919167 35.270846 \n",
       "L 420.855095 34.751383 \n",
       "L 421.791022 20.552727 \n",
       "L 424.598805 28.777558 \n",
       "L 425.534732 41.417825 \n",
       "L 426.47066 40.811785 \n",
       "L 427.406588 42.19702 \n",
       "L 428.342515 68.732923 \n",
       "L 431.150298 118.601373 \n",
       "L 432.086225 96.091308 \n",
       "L 433.022153 102.411442 \n",
       "L 433.95808 145.873181 \n",
       "L 434.894008 129.120499 \n",
       "L 437.701791 112.497682 \n",
       "L 438.637718 109.640636 \n",
       "L 440.509573 79.20876 \n",
       "L 441.445501 78.862452 \n",
       "L 445.189211 86.2648 \n",
       "L 446.125138 92.108759 \n",
       "L 447.061066 90.593658 \n",
       "L 447.996993 71.936278 \n",
       "L 450.804776 58.127219 \n",
       "L 451.740704 73.148358 \n",
       "L 452.676631 85.182585 \n",
       "L 453.612559 102.281576 \n",
       "L 454.548486 96.307751 \n",
       "L 457.356269 82.845001 \n",
       "L 458.292196 79.858089 \n",
       "L 459.228124 80.290975 \n",
       "L 460.164051 74.576882 \n",
       "L 461.099979 53.928226 \n",
       "L 463.907762 55.443327 \n",
       "L 464.843689 63.235272 \n",
       "L 465.779617 69.382251 \n",
       "L 466.715544 70.680909 \n",
       "L 467.651472 74.143996 \n",
       "L 470.459254 90.204061 \n",
       "L 471.395182 88.212786 \n",
       "L 472.33111 90.463792 \n",
       "L 473.267037 119.726876 \n",
       "L 474.202965 144.055061 \n",
       "L 477.010747 113.49332 \n",
       "L 477.946675 133.016472 \n",
       "L 478.882602 136.349693 \n",
       "L 479.81853 121.977882 \n",
       "L 483.56224 146.565799 \n",
       "L 484.498168 132.280566 \n",
       "L 485.434095 120.20305 \n",
       "L 486.370023 111.199025 \n",
       "L 487.30595 136.825867 \n",
       "L 490.113733 131.284928 \n",
       "L 491.04966 113.320165 \n",
       "L 491.985588 119.337279 \n",
       "L 492.921515 109.943656 \n",
       "L 493.857443 113.320165 \n",
       "L 496.665226 103.883254 \n",
       "L 497.601153 91.502718 \n",
       "L 498.537081 90.636947 \n",
       "L 499.473008 97.130234 \n",
       "L 500.408936 107.000032 \n",
       "L 503.216718 107.173186 \n",
       "L 504.152646 122.713788 \n",
       "L 505.088573 119.90003 \n",
       "L 506.024501 108.298689 \n",
       "L 506.960429 107.216475 \n",
       "L 509.768211 116.090635 \n",
       "L 510.704139 114.056071 \n",
       "L 511.640066 121.761439 \n",
       "L 512.575994 124.272177 \n",
       "L 513.511921 109.554058 \n",
       "L 516.319704 105.658086 \n",
       "L 517.255631 105.658086 \n",
       "L 519.127487 83.580907 \n",
       "L 520.063414 79.987955 \n",
       "L 522.871197 79.425203 \n",
       "L 523.807124 87.563457 \n",
       "L 524.743052 82.628558 \n",
       "L 525.678979 83.624196 \n",
       "L 526.614907 86.56782 \n",
       "L 529.42269 77.736948 \n",
       "L 530.358617 81.026881 \n",
       "L 531.294545 77.780237 \n",
       "L 532.230472 80.204398 \n",
       "L 533.1664 83.018156 \n",
       "L 536.91011 96.567483 \n",
       "L 537.846037 81.026881 \n",
       "L 538.781965 88.256075 \n",
       "L 539.717892 76.741311 \n",
       "L 542.525675 71.113795 \n",
       "L 543.461603 70.248023 \n",
       "L 544.39753 60.291648 \n",
       "L 545.333458 60.421514 \n",
       "L 546.269385 56.87185 \n",
       "L 549.077168 55.270173 \n",
       "L 550.013095 53.711784 \n",
       "L 550.949023 57.564468 \n",
       "L 551.884951 54.534267 \n",
       "L 552.820878 61.46044 \n",
       "L 555.628661 63.92789 \n",
       "L 556.564588 68.51648 \n",
       "L 557.500516 66.481916 \n",
       "L 558.436443 73.970841 \n",
       "L 559.372371 71.806412 \n",
       "L 562.180153 87.996343 \n",
       "L 563.116081 85.399028 \n",
       "L 564.052009 95.13896 \n",
       "L 564.987936 88.472517 \n",
       "L 565.923864 86.784263 \n",
       "L 565.923864 86.784263 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #4c72b0; stroke-width: 1.75; stroke-linecap: round\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_34\">\n",
       "    <path d=\"M 58.651136 287.607273 \n",
       "L 59.587064 285.776514 \n",
       "L 60.522991 284.598244 \n",
       "L 61.458919 282.837947 \n",
       "L 64.266702 282.329386 \n",
       "L 65.202629 281.947965 \n",
       "L 66.138557 280.969282 \n",
       "L 67.074484 280.852131 \n",
       "L 68.010412 280.201517 \n",
       "L 71.754122 280.579328 \n",
       "L 72.690049 280.321579 \n",
       "L 73.625977 281.037328 \n",
       "L 74.561905 280.675901 \n",
       "L 77.369687 281.043338 \n",
       "L 78.305615 279.749704 \n",
       "L 79.241542 276.647516 \n",
       "L 80.17747 274.580606 \n",
       "L 81.113397 273.420021 \n",
       "L 83.92118 274.086327 \n",
       "L 84.857108 274.607701 \n",
       "L 85.793035 274.901332 \n",
       "L 86.728963 274.959223 \n",
       "L 87.66489 273.303565 \n",
       "L 90.472673 272.505529 \n",
       "L 91.4086 271.89618 \n",
       "L 92.344528 271.114503 \n",
       "L 93.280455 269.056434 \n",
       "L 94.216383 266.528067 \n",
       "L 97.024166 263.268201 \n",
       "L 97.960093 259.816843 \n",
       "L 98.896021 255.908021 \n",
       "L 100.767876 250.75605 \n",
       "L 104.511586 247.41335 \n",
       "L 105.447513 245.13359 \n",
       "L 107.319369 241.513721 \n",
       "L 111.063079 239.22593 \n",
       "L 111.999006 235.205274 \n",
       "L 113.870861 232.625583 \n",
       "L 116.678644 232.495198 \n",
       "L 117.614571 233.165782 \n",
       "L 118.550499 234.144894 \n",
       "L 119.486427 234.554563 \n",
       "L 120.422354 233.963578 \n",
       "L 123.230137 233.390473 \n",
       "L 124.166064 233.945459 \n",
       "L 125.101992 232.143159 \n",
       "L 126.037919 231.300075 \n",
       "L 126.973847 232.236973 \n",
       "L 129.781629 233.221022 \n",
       "L 130.717557 237.248992 \n",
       "L 131.653485 239.674751 \n",
       "L 132.589412 241.764624 \n",
       "L 133.52534 243.516005 \n",
       "L 136.333122 245.089272 \n",
       "L 138.204977 243.69651 \n",
       "L 139.140905 242.335138 \n",
       "L 140.076832 241.909327 \n",
       "L 143.820543 241.964607 \n",
       "L 144.75647 242.670355 \n",
       "L 145.692398 242.485404 \n",
       "L 146.628325 242.606423 \n",
       "L 149.436108 242.545676 \n",
       "L 150.372035 242.803137 \n",
       "L 151.307963 244.110913 \n",
       "L 152.24389 246.736712 \n",
       "L 155.987601 246.476699 \n",
       "L 156.923528 247.039239 \n",
       "L 157.859456 247.926496 \n",
       "L 158.795383 246.535732 \n",
       "L 159.731311 246.304319 \n",
       "L 162.539093 243.338646 \n",
       "L 163.475021 239.620935 \n",
       "L 164.410949 236.994984 \n",
       "L 165.346876 234.809078 \n",
       "L 166.282804 233.7324 \n",
       "L 169.090586 232.275562 \n",
       "L 170.026514 231.085535 \n",
       "L 170.962441 230.506857 \n",
       "L 171.898369 229.769828 \n",
       "L 172.834296 228.199775 \n",
       "L 175.642079 227.065523 \n",
       "L 176.578007 226.452922 \n",
       "L 177.513934 225.528119 \n",
       "L 178.449862 225.364801 \n",
       "L 179.385789 225.675199 \n",
       "L 182.193572 224.479474 \n",
       "L 183.129499 223.820768 \n",
       "L 184.065427 227.936972 \n",
       "L 185.001354 229.996022 \n",
       "L 185.937282 229.873698 \n",
       "L 188.745065 228.472476 \n",
       "L 190.61692 225.023577 \n",
       "L 191.552847 222.410725 \n",
       "L 192.488775 220.505196 \n",
       "L 196.232485 219.303314 \n",
       "L 197.168412 218.466836 \n",
       "L 199.040268 212.856123 \n",
       "L 202.783978 210.227677 \n",
       "L 204.655833 208.400161 \n",
       "L 205.59176 208.157508 \n",
       "L 208.399543 208.029629 \n",
       "L 209.33547 206.645885 \n",
       "L 210.271398 205.943563 \n",
       "L 211.207326 205.925462 \n",
       "L 212.143253 207.134789 \n",
       "L 214.951036 205.855711 \n",
       "L 216.822891 207.366749 \n",
       "L 217.758818 207.999311 \n",
       "L 218.694746 208.159891 \n",
       "L 221.502529 208.107171 \n",
       "L 222.438456 210.188772 \n",
       "L 223.374384 209.412389 \n",
       "L 224.310311 211.146042 \n",
       "L 225.246239 211.959284 \n",
       "L 228.054021 212.125508 \n",
       "L 229.925876 211.644136 \n",
       "L 230.861804 213.685623 \n",
       "L 234.605514 213.129253 \n",
       "L 235.541442 213.024629 \n",
       "L 237.413297 208.996748 \n",
       "L 238.349224 206.278187 \n",
       "L 241.157007 204.271733 \n",
       "L 242.092934 202.626204 \n",
       "L 243.028862 199.952712 \n",
       "L 243.96479 197.828549 \n",
       "L 244.900717 196.473515 \n",
       "L 247.7085 195.522172 \n",
       "L 248.644427 194.159335 \n",
       "L 249.580355 193.126386 \n",
       "L 250.516282 192.600583 \n",
       "L 251.45221 192.520074 \n",
       "L 254.259992 192.611202 \n",
       "L 256.131848 191.559309 \n",
       "L 257.067775 191.685008 \n",
       "L 258.003703 191.292284 \n",
       "L 260.811485 190.499924 \n",
       "L 262.68334 190.626036 \n",
       "L 263.619268 194.448139 \n",
       "L 264.555195 196.925119 \n",
       "L 267.362978 196.163895 \n",
       "L 268.298906 195.625443 \n",
       "L 269.234833 194.756252 \n",
       "L 270.170761 198.270885 \n",
       "L 271.106688 201.318102 \n",
       "L 273.914471 203.397893 \n",
       "L 274.850398 202.208911 \n",
       "L 275.786326 202.269524 \n",
       "L 276.722253 202.931846 \n",
       "L 277.658181 202.811725 \n",
       "L 280.465964 202.710812 \n",
       "L 281.401891 202.332107 \n",
       "L 282.337819 200.79271 \n",
       "L 284.209674 195.59054 \n",
       "L 287.953384 195.682423 \n",
       "L 288.889311 194.842276 \n",
       "L 289.825239 194.244632 \n",
       "L 290.761167 194.110241 \n",
       "L 293.568949 191.163223 \n",
       "L 294.504877 188.0439 \n",
       "L 295.440804 185.574541 \n",
       "L 296.376732 183.8091 \n",
       "L 297.312659 183.459011 \n",
       "L 300.120442 182.622872 \n",
       "L 301.992297 180.95457 \n",
       "L 306.671935 181.751978 \n",
       "L 307.607862 182.035214 \n",
       "L 309.479717 180.245237 \n",
       "L 310.415645 178.578397 \n",
       "L 313.223428 176.148653 \n",
       "L 315.095283 171.612256 \n",
       "L 316.03121 168.391665 \n",
       "L 316.967138 166.290064 \n",
       "L 319.77492 165.168393 \n",
       "L 321.646775 161.994418 \n",
       "L 323.51863 160.268578 \n",
       "L 326.326413 159.202111 \n",
       "L 329.134196 156.352762 \n",
       "L 330.070123 154.295618 \n",
       "L 332.877906 153.834975 \n",
       "L 333.813833 153.002496 \n",
       "L 334.749761 153.75255 \n",
       "L 335.685689 153.957959 \n",
       "L 336.621616 151.850188 \n",
       "L 339.429399 151.308285 \n",
       "L 340.365326 150.468972 \n",
       "L 342.237181 148.615235 \n",
       "L 343.173109 147.042305 \n",
       "L 345.980891 145.429723 \n",
       "L 346.916819 144.415084 \n",
       "L 347.852747 143.177931 \n",
       "L 349.724602 143.420987 \n",
       "L 352.532384 143.276486 \n",
       "L 353.468312 143.817438 \n",
       "L 354.404239 145.619209 \n",
       "L 355.340167 144.61131 \n",
       "L 356.276094 144.677868 \n",
       "L 359.083877 144.251613 \n",
       "L 360.019805 142.102978 \n",
       "L 360.955732 140.740412 \n",
       "L 362.827587 139.069158 \n",
       "L 365.63537 137.956406 \n",
       "L 366.571297 134.264795 \n",
       "L 367.507225 131.669241 \n",
       "L 368.443152 127.233482 \n",
       "L 369.37908 124.501881 \n",
       "L 372.186863 122.799489 \n",
       "L 374.058718 122.31017 \n",
       "L 374.994645 121.231461 \n",
       "L 375.930573 118.86404 \n",
       "L 378.738355 116.222702 \n",
       "L 379.674283 113.733058 \n",
       "L 380.61021 111.898292 \n",
       "L 381.546138 111.701831 \n",
       "L 382.482066 110.634602 \n",
       "L 386.225776 107.147897 \n",
       "L 387.161703 106.6564 \n",
       "L 388.097631 105.69256 \n",
       "L 389.033558 105.045435 \n",
       "L 392.777269 104.9064 \n",
       "L 393.713196 104.661435 \n",
       "L 394.649124 103.882494 \n",
       "L 395.585051 104.391325 \n",
       "L 399.328761 102.705918 \n",
       "L 400.264689 99.602098 \n",
       "L 401.200616 96.040508 \n",
       "L 402.136544 91.410508 \n",
       "L 404.944327 87.3969 \n",
       "L 405.880254 83.715721 \n",
       "L 406.816182 81.409367 \n",
       "L 407.752109 77.515172 \n",
       "L 408.688037 72.646539 \n",
       "L 412.431747 70.023169 \n",
       "L 413.367674 65.198594 \n",
       "L 414.303602 62.088805 \n",
       "L 415.23953 58.382049 \n",
       "L 418.047312 53.134534 \n",
       "L 418.98324 48.549568 \n",
       "L 419.919167 45.229888 \n",
       "L 420.855095 42.610262 \n",
       "L 421.791022 37.095878 \n",
       "L 424.598805 35.016298 \n",
       "L 425.534732 36.61668 \n",
       "L 427.406588 38.798347 \n",
       "L 428.342515 46.281991 \n",
       "L 431.150298 64.361836 \n",
       "L 433.022153 79.823514 \n",
       "L 433.95808 96.335931 \n",
       "L 434.894008 104.532073 \n",
       "L 438.637718 107.302765 \n",
       "L 439.573646 104.002082 \n",
       "L 440.509573 97.803752 \n",
       "L 441.445501 93.068427 \n",
       "L 445.189211 91.36752 \n",
       "L 446.125138 91.55283 \n",
       "L 447.061066 91.313037 \n",
       "L 447.996993 86.468847 \n",
       "L 450.804776 79.38344 \n",
       "L 451.740704 77.82467 \n",
       "L 452.676631 79.664148 \n",
       "L 453.612559 85.318505 \n",
       "L 454.548486 88.065817 \n",
       "L 457.356269 86.760613 \n",
       "L 458.292196 85.034982 \n",
       "L 459.228124 83.84898 \n",
       "L 460.164051 81.530956 \n",
       "L 461.099979 74.630273 \n",
       "L 464.843689 68.183971 \n",
       "L 465.779617 68.483541 \n",
       "L 466.715544 69.032883 \n",
       "L 467.651472 70.310661 \n",
       "L 470.459254 75.284011 \n",
       "L 472.33111 81.503102 \n",
       "L 473.267037 91.059045 \n",
       "L 474.202965 104.308049 \n",
       "L 477.010747 106.604367 \n",
       "L 477.946675 113.207393 \n",
       "L 478.882602 118.992968 \n",
       "L 479.81853 119.739196 \n",
       "L 484.498168 127.904527 \n",
       "L 485.434095 125.979158 \n",
       "L 486.370023 122.284124 \n",
       "L 487.30595 125.91956 \n",
       "L 490.113733 127.260902 \n",
       "L 491.04966 123.775718 \n",
       "L 491.985588 122.666108 \n",
       "L 492.921515 119.485495 \n",
       "L 493.857443 117.944163 \n",
       "L 496.665226 114.428935 \n",
       "L 497.601153 108.697381 \n",
       "L 498.537081 104.182273 \n",
       "L 499.473008 102.419263 \n",
       "L 500.408936 103.564455 \n",
       "L 503.216718 104.466638 \n",
       "L 504.152646 109.028426 \n",
       "L 505.088573 111.746327 \n",
       "L 506.960429 109.967432 \n",
       "L 509.768211 111.498233 \n",
       "L 510.704139 112.137692 \n",
       "L 512.575994 116.975766 \n",
       "L 513.511921 115.120339 \n",
       "L 516.319704 112.754776 \n",
       "L 517.255631 110.980603 \n",
       "L 518.191559 106.85786 \n",
       "L 520.063414 95.775955 \n",
       "L 522.871197 91.688267 \n",
       "L 523.807124 90.657065 \n",
       "L 524.743052 88.649938 \n",
       "L 525.678979 87.393503 \n",
       "L 526.614907 87.187082 \n",
       "L 529.42269 84.824548 \n",
       "L 530.358617 83.875132 \n",
       "L 531.294545 82.351408 \n",
       "L 532.230472 81.814655 \n",
       "L 533.1664 82.11553 \n",
       "L 536.91011 85.728519 \n",
       "L 537.846037 84.553109 \n",
       "L 538.781965 85.47885 \n",
       "L 539.717892 83.294466 \n",
       "L 542.525675 80.249298 \n",
       "L 543.461603 77.748979 \n",
       "L 544.39753 73.384646 \n",
       "L 546.269385 66.82586 \n",
       "L 549.077168 63.936938 \n",
       "L 550.013095 61.38065 \n",
       "L 550.949023 60.426604 \n",
       "L 551.884951 58.95352 \n",
       "L 552.820878 59.58025 \n",
       "L 555.628661 60.66716 \n",
       "L 556.564588 62.62949 \n",
       "L 557.500516 63.592596 \n",
       "L 558.436443 66.187158 \n",
       "L 559.372371 67.591971 \n",
       "L 562.180153 72.693064 \n",
       "L 563.116081 75.869555 \n",
       "L 564.052009 80.686906 \n",
       "L 564.987936 82.633309 \n",
       "L 565.923864 83.671047 \n",
       "L 565.923864 83.671047 \n",
       "\" clip-path=\"url(#pf6d92d4b4a)\" style=\"fill: none; stroke: #55a868; stroke-width: 1.75; stroke-linecap: round\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 33.2875 300.96 \n",
       "L 33.2875 7.2 \n",
       "\" style=\"fill: none\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 591.2875 300.96 \n",
       "L 591.2875 7.2 \n",
       "\" style=\"fill: none\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 33.2875 300.96 \n",
       "L 591.2875 300.96 \n",
       "\" style=\"fill: none\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 33.2875 7.2 \n",
       "L 591.2875 7.2 \n",
       "\" style=\"fill: none\"/>\n",
       "   </g>\n",
       "   <g id=\"legend_1\">\n",
       "    <g id=\"line2d_35\">\n",
       "     <path d=\"M 519.248438 20.298437 \n",
       "L 529.248438 20.298437 \n",
       "L 539.248438 20.298437 \n",
       "\" style=\"fill: none; stroke: #4c72b0; stroke-width: 1.75; stroke-linecap: round\"/>\n",
       "    </g>\n",
       "    <g id=\"text_18\">\n",
       "     <!-- SPY -->\n",
       "     <g style=\"fill: #262626\" transform=\"translate(547.248438 23.798437) scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSerif-53\" d=\"M 594 225 \n",
       "L 594 1288 \n",
       "L 953 1284 \n",
       "Q 969 753 1261 498 \n",
       "Q 1553 244 2150 244 \n",
       "Q 2706 244 2998 464 \n",
       "Q 3291 684 3291 1106 \n",
       "Q 3291 1444 3114 1625 \n",
       "Q 2938 1806 2369 1978 \n",
       "L 1753 2163 \n",
       "Q 1084 2366 811 2669 \n",
       "Q 538 2972 538 3500 \n",
       "Q 538 4094 959 4422 \n",
       "Q 1381 4750 2144 4750 \n",
       "Q 2469 4750 2856 4679 \n",
       "Q 3244 4609 3681 4475 \n",
       "L 3681 3481 \n",
       "L 3328 3481 \n",
       "Q 3275 3975 2998 4195 \n",
       "Q 2722 4416 2156 4416 \n",
       "Q 1663 4416 1405 4214 \n",
       "Q 1147 4013 1147 3628 \n",
       "Q 1147 3294 1340 3103 \n",
       "Q 1534 2913 2163 2725 \n",
       "L 2741 2553 \n",
       "Q 3375 2363 3645 2067 \n",
       "Q 3916 1772 3916 1275 \n",
       "Q 3916 597 3481 253 \n",
       "Q 3047 -91 2188 -91 \n",
       "Q 1803 -91 1404 -12 \n",
       "Q 1006 66 594 225 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-50\" d=\"M 1581 2375 \n",
       "L 2406 2375 \n",
       "Q 2872 2375 3115 2626 \n",
       "Q 3359 2878 3359 3353 \n",
       "Q 3359 3831 3115 4081 \n",
       "Q 2872 4331 2406 4331 \n",
       "L 1581 4331 \n",
       "L 1581 2375 \n",
       "z\n",
       "M 353 0 \n",
       "L 353 331 \n",
       "L 947 331 \n",
       "L 947 4331 \n",
       "L 353 4331 \n",
       "L 353 4666 \n",
       "L 2559 4666 \n",
       "Q 3259 4666 3668 4311 \n",
       "Q 4078 3956 4078 3353 \n",
       "Q 4078 2753 3668 2397 \n",
       "Q 3259 2041 2559 2041 \n",
       "L 1581 2041 \n",
       "L 1581 331 \n",
       "L 2303 331 \n",
       "L 2303 0 \n",
       "L 353 0 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-59\" d=\"M 1209 0 \n",
       "L 1209 331 \n",
       "L 1806 331 \n",
       "L 1806 2009 \n",
       "L 366 4331 \n",
       "L -72 4331 \n",
       "L -72 4666 \n",
       "L 1663 4666 \n",
       "L 1663 4331 \n",
       "L 1119 4331 \n",
       "L 2284 2444 \n",
       "L 3450 4331 \n",
       "L 2925 4331 \n",
       "L 2925 4666 \n",
       "L 4281 4666 \n",
       "L 4281 4331 \n",
       "L 3841 4331 \n",
       "L 2438 2069 \n",
       "L 2438 331 \n",
       "L 3034 331 \n",
       "L 3034 0 \n",
       "L 1209 0 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSerif-53\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-50\" x=\"68.505859\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-59\" x=\"135.791016\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"line2d_36\">\n",
       "     <path d=\"M 519.248438 34.976562 \n",
       "L 529.248438 34.976562 \n",
       "L 539.248438 34.976562 \n",
       "\" style=\"fill: none; stroke: #55a868; stroke-width: 1.75; stroke-linecap: round\"/>\n",
       "    </g>\n",
       "    <g id=\"text_19\">\n",
       "     <!-- EWMA -->\n",
       "     <g style=\"fill: #262626\" transform=\"translate(547.248438 38.476562) scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSerif-45\" d=\"M 353 0 \n",
       "L 353 331 \n",
       "L 947 331 \n",
       "L 947 4331 \n",
       "L 353 4331 \n",
       "L 353 4666 \n",
       "L 4109 4666 \n",
       "L 4109 3628 \n",
       "L 3725 3628 \n",
       "L 3725 4281 \n",
       "L 1581 4281 \n",
       "L 1581 2719 \n",
       "L 3109 2719 \n",
       "L 3109 3303 \n",
       "L 3494 3303 \n",
       "L 3494 1753 \n",
       "L 3109 1753 \n",
       "L 3109 2338 \n",
       "L 1581 2338 \n",
       "L 1581 384 \n",
       "L 3775 384 \n",
       "L 3775 1038 \n",
       "L 4159 1038 \n",
       "L 4159 0 \n",
       "L 353 0 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-57\" d=\"M 4878 0 \n",
       "L 4366 0 \n",
       "L 3297 3794 \n",
       "L 2228 0 \n",
       "L 1716 0 \n",
       "L 494 4331 \n",
       "L 31 4331 \n",
       "L 31 4666 \n",
       "L 1734 4666 \n",
       "L 1734 4331 \n",
       "L 1153 4331 \n",
       "L 2125 884 \n",
       "L 3188 4666 \n",
       "L 3694 4666 \n",
       "L 4775 844 \n",
       "L 5753 4331 \n",
       "L 5216 4331 \n",
       "L 5216 4666 \n",
       "L 6559 4666 \n",
       "L 6559 4331 \n",
       "L 6100 4331 \n",
       "L 4878 0 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-4d\" d=\"M 353 0 \n",
       "L 353 331 \n",
       "L 947 331 \n",
       "L 947 4331 \n",
       "L 319 4331 \n",
       "L 319 4666 \n",
       "L 1678 4666 \n",
       "L 3316 1344 \n",
       "L 4953 4666 \n",
       "L 6228 4666 \n",
       "L 6228 4331 \n",
       "L 5606 4331 \n",
       "L 5606 331 \n",
       "L 6203 331 \n",
       "L 6203 0 \n",
       "L 4378 0 \n",
       "L 4378 331 \n",
       "L 4972 331 \n",
       "L 4972 3938 \n",
       "L 3372 684 \n",
       "L 2931 684 \n",
       "L 1331 3938 \n",
       "L 1331 331 \n",
       "L 1925 331 \n",
       "L 1925 0 \n",
       "L 353 0 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSerif-41\" d=\"M 1281 1691 \n",
       "L 2994 1691 \n",
       "L 2138 3909 \n",
       "L 1281 1691 \n",
       "z\n",
       "M -38 0 \n",
       "L -38 331 \n",
       "L 372 331 \n",
       "L 2034 4666 \n",
       "L 2559 4666 \n",
       "L 4225 331 \n",
       "L 4684 331 \n",
       "L 4684 0 \n",
       "L 2988 0 \n",
       "L 2988 331 \n",
       "L 3506 331 \n",
       "L 3116 1356 \n",
       "L 1153 1356 \n",
       "L 763 331 \n",
       "L 1275 331 \n",
       "L 1275 0 \n",
       "L -38 0 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSerif-45\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-57\" x=\"72.998047\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-4d\" x=\"175.78125\"/>\n",
       "      <use xlink:href=\"#DejaVuSerif-41\" x=\"278.173828\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"pf6d92d4b4a\">\n",
       "   <rect x=\"33.2875\" y=\"7.2\" width=\"558\" height=\"293.76\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 1000x600 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "data[data.index > '2017-1-1'].plot(figsize=(10, 6));"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Pure Python"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 159,
   "metadata": {},
   "outputs": [],
   "source": [
    "def ewma_py(x, alpha):\n",
    "    y = np.zeros_like(x)\n",
    "    y[0] = x[0]\n",
    "    for i in range(1, len(x)):\n",
    "        y[i] = alpha * x[i] + (1-alpha) * y[i-1]\n",
    "    return y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 160,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 12.6 ms, sys: 390 µs, total: 13 ms\n",
      "Wall time: 12.7 ms\n"
     ]
    }
   ],
   "source": [
    "%time data['EWMA_PY'] = ewma_py(data[sym], alpha)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 161,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 628 µs, sys: 30 µs, total: 658 µs\n",
      "Wall time: 644 µs\n"
     ]
    }
   ],
   "source": [
    "%time data['EWMA_PY'] = ewma_py(data[sym].values, alpha)  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Numba"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 162,
   "metadata": {},
   "outputs": [],
   "source": [
    "ewma_nb = numba.jit(ewma_py)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 163,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 94.3 ms, sys: 3.48 ms, total: 97.8 ms\n",
      "Wall time: 96.9 ms\n"
     ]
    }
   ],
   "source": [
    "%time data['EWMA_NB'] = ewma_nb(data[sym].values, alpha)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 164,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "27.2 µs ± 94.3 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n"
     ]
    }
   ],
   "source": [
    "%timeit data['EWMA_NB'] = ewma_nb(data[sym].values, alpha)  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Cython"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 165,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%cython\n",
    "import numpy as np\n",
    "cimport cython\n",
    "@cython.boundscheck(False)\n",
    "@cython.wraparound(False)\n",
    "def ewma_cy(double[:] x, float alpha):\n",
    "    cdef int i\n",
    "    cdef double[:] y = np.empty_like(x)\n",
    "    y[0] = x[0]\n",
    "    for i in range(1, len(x)):\n",
    "        y[i] = alpha * x[i] + (1 - alpha) * y[i - 1]\n",
    "    return y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 166,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 418 µs, sys: 237 µs, total: 655 µs\n",
      "Wall time: 680 µs\n"
     ]
    }
   ],
   "source": [
    "%time data['EWMA_CY'] = ewma_cy(data[sym].values, alpha)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 167,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "48.2 µs ± 2.3 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n"
     ]
    }
   ],
   "source": [
    "%timeit data['EWMA_CY'] = ewma_cy(data[sym].values, alpha)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 168,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>SPY</th>\n",
       "      <th>EWMA</th>\n",
       "      <th>EWMA_PY</th>\n",
       "      <th>EWMA_NB</th>\n",
       "      <th>EWMA_CY</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2010-01-04</th>\n",
       "      <td>113.33</td>\n",
       "      <td>113.330000</td>\n",
       "      <td>113.330000</td>\n",
       "      <td>113.330000</td>\n",
       "      <td>[113.33, 113.405, 113.48125, 113.6584375, 113....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2010-01-05</th>\n",
       "      <td>113.63</td>\n",
       "      <td>113.405000</td>\n",
       "      <td>113.405000</td>\n",
       "      <td>113.405000</td>\n",
       "      <td>[113.33, 113.405, 113.48125, 113.6584375, 113....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2010-01-06</th>\n",
       "      <td>113.71</td>\n",
       "      <td>113.481250</td>\n",
       "      <td>113.481250</td>\n",
       "      <td>113.481250</td>\n",
       "      <td>[113.33, 113.405, 113.48125, 113.6584375, 113....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2010-01-07</th>\n",
       "      <td>114.19</td>\n",
       "      <td>113.658438</td>\n",
       "      <td>113.658438</td>\n",
       "      <td>113.658438</td>\n",
       "      <td>[113.33, 113.405, 113.48125, 113.6584375, 113....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2010-01-08</th>\n",
       "      <td>114.57</td>\n",
       "      <td>113.886328</td>\n",
       "      <td>113.886328</td>\n",
       "      <td>113.886328</td>\n",
       "      <td>[113.33, 113.405, 113.48125, 113.6584375, 113....</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               SPY        EWMA     EWMA_PY     EWMA_NB  \\\n",
       "Date                                                     \n",
       "2010-01-04  113.33  113.330000  113.330000  113.330000   \n",
       "2010-01-05  113.63  113.405000  113.405000  113.405000   \n",
       "2010-01-06  113.71  113.481250  113.481250  113.481250   \n",
       "2010-01-07  114.19  113.658438  113.658438  113.658438   \n",
       "2010-01-08  114.57  113.886328  113.886328  113.886328   \n",
       "\n",
       "                                                      EWMA_CY  \n",
       "Date                                                           \n",
       "2010-01-04  [113.33, 113.405, 113.48125, 113.6584375, 113....  \n",
       "2010-01-05  [113.33, 113.405, 113.48125, 113.6584375, 113....  \n",
       "2010-01-06  [113.33, 113.405, 113.48125, 113.6584375, 113....  \n",
       "2010-01-07  [113.33, 113.405, 113.48125, 113.6584375, 113....  \n",
       "2010-01-08  [113.33, 113.405, 113.48125, 113.6584375, 113....  "
      ]
     },
     "execution_count": 168,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 169,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>SPY</th>\n",
       "      <th>EWMA</th>\n",
       "      <th>EWMA_PY</th>\n",
       "      <th>EWMA_NB</th>\n",
       "      <th>EWMA_CY</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018-06-25</th>\n",
       "      <td>271.00</td>\n",
       "      <td>274.535176</td>\n",
       "      <td>274.535176</td>\n",
       "      <td>274.535176</td>\n",
       "      <td>[113.33, 113.405, 113.48125, 113.6584375, 113....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-06-26</th>\n",
       "      <td>271.60</td>\n",
       "      <td>273.801382</td>\n",
       "      <td>273.801382</td>\n",
       "      <td>273.801382</td>\n",
       "      <td>[113.33, 113.405, 113.48125, 113.6584375, 113....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-06-27</th>\n",
       "      <td>269.35</td>\n",
       "      <td>272.688537</td>\n",
       "      <td>272.688537</td>\n",
       "      <td>272.688537</td>\n",
       "      <td>[113.33, 113.405, 113.48125, 113.6584375, 113....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-06-28</th>\n",
       "      <td>270.89</td>\n",
       "      <td>272.238903</td>\n",
       "      <td>272.238903</td>\n",
       "      <td>272.238903</td>\n",
       "      <td>[113.33, 113.405, 113.48125, 113.6584375, 113....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-06-29</th>\n",
       "      <td>271.28</td>\n",
       "      <td>271.999177</td>\n",
       "      <td>271.999177</td>\n",
       "      <td>271.999177</td>\n",
       "      <td>[113.33, 113.405, 113.48125, 113.6584375, 113....</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               SPY        EWMA     EWMA_PY     EWMA_NB  \\\n",
       "Date                                                     \n",
       "2018-06-25  271.00  274.535176  274.535176  274.535176   \n",
       "2018-06-26  271.60  273.801382  273.801382  273.801382   \n",
       "2018-06-27  269.35  272.688537  272.688537  272.688537   \n",
       "2018-06-28  270.89  272.238903  272.238903  272.238903   \n",
       "2018-06-29  271.28  271.999177  271.999177  271.999177   \n",
       "\n",
       "                                                      EWMA_CY  \n",
       "Date                                                           \n",
       "2018-06-25  [113.33, 113.405, 113.48125, 113.6584375, 113....  \n",
       "2018-06-26  [113.33, 113.405, 113.48125, 113.6584375, 113....  \n",
       "2018-06-27  [113.33, 113.405, 113.48125, 113.6584375, 113....  \n",
       "2018-06-28  [113.33, 113.405, 113.48125, 113.6584375, 113....  \n",
       "2018-06-29  [113.33, 113.405, 113.48125, 113.6584375, 113....  "
      ]
     },
     "execution_count": 169,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.tail()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src=\"http://hilpisch.com/tpq_logo.png\" alt=\"The Python Quants\" width=\"35%\" align=\"right\" border=\"0\"><br>\n",
    "\n",
    "<a href=\"http://tpq.io\" target=\"_blank\">http://tpq.io</a> | <a href=\"http://twitter.com/dyjh\" target=\"_blank\">@dyjh</a> | <a href=\"mailto:training@tpq.io\">training@tpq.io</a>"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
